4242- curve fitting https://www.youtube.com/watch?v=vHM_5AeKwXE
4343- do for [i=1:96] { plot f(x,i*0.1) }
4444- operators http://www.gnuplot.info/docs_4.2/node55.html
45+ - Colors
46+ - rgb "#0b0000"
47+ - rgb "white"
4548
4649** functions
4750- http://www.gnuplot.info/docs/loc1283.html
5659
5760** commands
5861
59- |-------+------------------------------------+-----------------------------|
60- | <r> | | |
61- | unset | OPTION | |
62- | set | OPTION [VALUE] | |
63- | with | (l)ines[*], dots[.], lines(points) | |
64- | show | variables | |
65- | stats | FILENAME name S | shows file field statistics |
66- | | | later can be referenced |
67- | | | eg: S_min_x |
68- |-------+------------------------------------+-----------------------------|
62+ |-----------+------------------------------------+-----------------------------|
63+ | <r> | | |
64+ | multiplot | layout N,N | |
65+ | unset | OPTION | |
66+ | set | OPTION [VALUE] | |
67+ | with | (l)ines[*], dots[.], lines(points) | |
68+ | show | variables | |
69+ | stats | FILENAME name S | shows file field statistics |
70+ | | | later can be referenced |
71+ | | | eg: S_min_x |
72+ |-----------+------------------------------------+-----------------------------|
6973
7074*** plot
7175
76+ #+begin_src gnuplot
77+ [re]plot INPUT [PLOT_A OPTS], INPUT [PLOT_B OPTS]
78+ #+end_src
79+
7280|--------------+-------------------------|
7381| <c> | |
7482| INPUT | reads from... |
7583|--------------+-------------------------|
7684| "file.txt" | file contents |
7785| "/dev/stdin" | standard input |
78- | "< CMD" | CMD stdout |
86+ | "< CMD" | CMD stdout |
7987| "" | re-use last given input |
8088|--------------+-------------------------|
8189
82- - [re]plot INPUT [PLOT_A OPTS], INPUT [PLOT_B OPTS]
83- - every N - plots every N data points
84- - for [n = 1 : 5]
85- - widths = "30 15 5"
86- for [width in widths]
87- - using N:N+1:N+n
88- - [[http://www.gnuplot.info/docs/loc9016.html][smooth]]
89- - [[http://www.gnuplot.info/docs/loc9099.html][frequency]] - points with the same X-value are replaced with 1 point with Y-values sum
90- - [bezier¦mcsplines]
91- - title S (for legend box)
92- - bins=N - total N number of bins in graph http://gnuplot.info/docs_6.1/loc9125.html
93- - binvalue=[avg¦sum] - how to group each bin, default: sum
94- - index N
95- - reference block N of data (aka separated by 2 \n)
96- - blocks index start at 0
97- - with
98- - histograms
99- - filledcurves
100- - fillstyle pattern N
101- - linespoint
102- - lines
103- - [d]ash[t]ype N
104- - [d]ash[t]ype S
105- - [l]ine[s]tyle N
106- - [l]ine[t]ype N
107- - [l]ine[c]olor rgb "#0b0000"
108- - [l]ine[c]olor rgb "green"
109- - [l]ine[w]ith N
110- - points
111- - pointsize N
90+ - every N - plots every N data points
91+ - for [VAR = START : END]
92+ - for [LVAR in VAR] # widths = "30 15 5"
93+ - using N:N+1:N+n
94+ - [[http://www.gnuplot.info/docs/loc9016.html][smooth]]
95+ - [[http://www.gnuplot.info/docs/loc9099.html][frequency]] - points with the same X-value are replaced with 1 point with Y-values sum
96+ - [bezier¦mcsplines]
97+ - title S (for legend box)
98+ - bins=N - total N number of bins (NOT SIZE) in graph http://gnuplot.info/docs_6.1/loc9125.html
99+ - binvalue=[avg¦sum] - how to group each bin, default: sum
100+ - index N
101+ - reference block N of data (aka separated by 2 \n)
102+ - blocks index start at 0
103+
104+ - with
105+ - histograms
106+ - filledcurves
107+ - [f]ill[s]tyle pattern N
108+ - points
109+ - pointsize N
110+ - lines
111+ - [d]ash[t]ype N¦S
112+ - [l]ine[t]ype N
113+ - [l]ine[s]tyle N
114+ - [l]ine[w]idth N
115+ - [l]ine[c]olor COLOR
116+ - linespoint
117+
118+ *** fit
119+
120+ 1) We come up with a function shape that "fits" our data.
121+ - the function has 2 types of variables
122+ - variables that depend on the input (eg: x)
123+ - variables that we want to find it's value and make "constants" (eg: a)
124+ 2) We use =fit= command giving it:
125+ - the function in 1)
126+ - the input data
127+ - the fields *using*
128+ - the list of variables to find
129+
130+ #+begin_src gnuplot
131+ f(x) = a*x + b
132+ fit f(x) "" using 1:2 via a,b
133+ #+end_src
134+
135+ - https://www.youtube.com/watch?v=vHM_5AeKwXE
136+
137+ **** Example output
138+
139+ #+begin_src
140+ gnuplot> fit f(x) "<awk -vOFS=, '/EZEIZA/{ print $1,$2,$3 }' registro_temperatura365d_smn.txt" using 3:2 via a,b
141+ iter chisq delta/lim lambda a b
142+ 0 4.3014300000e+04 0.00e+00 9.71e+00 1.000000e+00 1.000000e+00
143+ 1 7.0509078061e+03 -5.10e+05 9.71e-01 1.315008e+00 6.153986e+00
144+ 2 3.9723792475e+03 -7.75e+04 9.71e-02 9.075167e-01 1.243513e+01
145+ 3 3.9719144040e+03 -1.17e+01 9.71e-03 9.024370e-01 1.251326e+01
146+ 4 3.9719144040e+03 -1.81e-07 9.71e-04 9.024364e-01 1.251327e+01
147+ iter chisq delta/lim lambda a b
148+
149+ After 4 iterations the fit converged.
150+ final sum of squares of residuals : 3971.91
151+ rel. change during last iteration : -1.81067e-12
152+
153+ degrees of freedom (FIT_NDF) : 363
154+ rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 3.30786
155+ variance of residuals (reduced chisquare) = WSSR/ndf : 10.9419
156+
157+ Final set of parameters Asymptotic Standard Error
158+ ======================= ==========================
159+ a = 0.902436 +/- 0.02768 (3.067%)
160+ b = 12.5133 +/- 0.3791 (3.03%)
161+
162+ correlation matrix of the fit parameters:
163+ a b
164+ a 1.000
165+ b -0.890 1.000
166+ #+end_src
112167
113168*** other
114169- imagesc - matrix/heatmap - 2d contour
134189| +reread+ | - | REMOVED in 6.0 +reread input+ |
135190|------------+------------+-------------------------------------|
136191
192+ #+CAPTIONS: background
193+ #+begin_src gnuplot
194+ set object rectangle \
195+ from screen 0,0 to screen 1,1 \
196+ behind \
197+ fillcolor rgb '$background' \
198+ fillstyle solid \
199+ noborder
200+ #+end_src
201+
137202*** general: file parsing
138203
139204|-------------+-----------------+----------------------------------|
158223| <c> | <c> | |
159224|---------------+----------------+----------------------------------|
160225| border | [N] | pick axis lines (takes a bitsum) |
226+ | | linecolor COL | |
161227| grid | - | axis grid |
162228| logscale | [x¦y] [N] | with step N |
163229| autoscale | [[x¦y]fix] | prevents autoextend of scale |
170236| | (S N[,S N]) | custom labels S at point N |
171237| [xyz]tic | rotate by N | rotates tic labels |
172238| [xyz][2]label | S | axis label |
173- | | offset N | |
239+ | | offset N[,N] | |
174240|---------------+----------------+----------------------------------|
175241*** key
176242
204270
205271#+CAPTION: gnuplot "test" command output
206272#+ATTR_HTML: :width 500
207- #+ATTR_ORG: :width 600
273+ #+ATTR_ORG: :width 800
208274[[./test_page.png]]
209275
210276*** term[inal]
@@ -251,6 +317,7 @@ http://gnuplot.info/demo/pm3dcolors.html
251317* tools
252318
253319- emacs: [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html][Org-babel-gnuplot]]
320+ - color theming https://github.com/GideonWolfe/Gnuplot-Pywal
254321- wrapper: plot realtime and stored data from the cli https://github.com/dkogan/feedgnuplot
255322- config https://github.com/Gnuplotting/gnuplot-configs
256323- pallettes
@@ -267,3 +334,7 @@ http://gnuplot.info/demo/pm3dcolors.html
267334- no *%a* date format for input parsing
268335- to read from stdin "-" might not work in plot (?
269336 - use /dev/stdin
337+ - you cannot plot fields from differents files/inputs against each other
338+ - on multiplot, sometimes a plot will silently fail due some formatting issue
339+ - try adding ";"
340+ - try adding "\n"
0 commit comments