File tree Expand file tree Collapse file tree 18 files changed +210
-12
lines changed
Filter options
Expand file tree Collapse file tree 18 files changed +210
-12
lines changed
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ PNG_EXT ?= .png
6
6
7
7
GIFS := $(patsubst % $(GIF_EXT )$(IN_EXT ) ,% $(GIF_EXT ) ,$(wildcard * $(IN_EXT ) ) )
8
8
PNGS := $(patsubst % $(IN_EXT ) ,% $(PNG_EXT ) ,$(wildcard * $(IN_EXT ) ) )
9
- PNGS := $(filter-out main$(PNG_EXT ) ,$(PNGS ) )
9
+ # Remove some special files that should not be rendered.
10
+ PNGS := $(filter-out main$(PNG_EXT ) template$(PNG_EXT ) ,$(PNGS ) )
10
11
11
12
.PHONY : clean
12
13
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ Minimal explained Gnuplot examples.
13
13
1 . [ Label] ( label.gnuplot )
14
14
1 . [ key] ( key.gnuplot )
15
15
1 . [ key title] ( key-title.gnuplot )
16
+ 1 . [ columnheader] ( columnheader.gnuplot )
16
17
1 . Axis
17
18
1 . [ Range] ( range.gnuplot )
18
19
1 . [ offset graph] ( offset-graph.gnuplot )
@@ -34,6 +35,8 @@ Minimal explained Gnuplot examples.
34
35
1 . [ Inline data] ( inline-data.gnuplot )
35
36
1 . [ Samples] ( samples.gnuplot )
36
37
1 . [ object circle] ( object-circle.gnuplot )
37
- 1 . [ splot] ( splot.gnuplot )
38
+ 1 . 3D
39
+ 1 . [ splot] ( splot.gnuplot )
40
+ 1 . [ pm3d] ( pm3d )
38
41
1 . [ GIF animation] ( animation.gif.gnuplot )
39
42
1 . [ Interactive] ( interactive/ )
Original file line number Diff line number Diff line change
1
+ # Bibliography
2
+
3
+ - < http://www.gnuplotting.org >
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env gnuplot
2
+
3
+ # Take title from file. Skips the line.
4
+
5
+ plot ' -' linewidth 3 title columnheader (1 )
6
+ Square
7
+ 1 1
8
+ 2 4
9
+ 3 9
10
+ e
Original file line number Diff line number Diff line change 2
2
3
3
# Multiple plots from a single file.
4
4
5
+ set multiplot layout 4 ,1
6
+
7
+ # Column choice method.
5
8
plot " square-line.data" using 1 :2 title " Square" , \
6
9
" square-line.data" using 3 :4 title " Line"
10
+
11
+ # Double empty line separated data sets.
12
+ plot ' -' with lines
13
+ 1 1
14
+ 2 2
15
+ 3 3
16
+
17
+
18
+ 1 1
19
+ 2 4
20
+ 3 9
21
+ e
22
+
23
+ # Select a single data set from multiple data set file.
24
+ plot ' multiple.data' index 0 with lines linecolor rgb ' red' , \
25
+ ' multiple.data' index 1 with lines linecolor rgb ' green'
26
+
27
+ # Choose by data name (from comments).
28
+ plot ' multiple.data' index ' Square' with lines linecolor rgb ' red' , \
29
+ ' multiple.data' index ' Line' with lines linecolor rgb ' green'
30
+
31
+ # TODO: same as above but inline?
32
+ # Maybe the problem is that each `-` expects a new file.
33
+ # http://stackoverflow.com/questions/10397750/embedding-multiple-datasets-in-a-gnuplot-command-script
34
+ # plot '-' index 0 with lines linecolor rgb 'red', \
35
+ # '-' index 1 with lines linecolor rgb 'green'
36
+ # 1 1
37
+ # 2 2
38
+ # 3 3
39
+
40
+
41
+ # 1 1
42
+ # 2 4
43
+ # 3 9
44
+ # e
45
+
46
+ unset multiplot
Original file line number Diff line number Diff line change 10
10
# - newline separated rows
11
11
# - lines starting with # are ignored
12
12
# - single empty lines are ignored
13
- # - double empty lines mean a new data set
13
+ # - double empty lines mean a new data set. Use `using lines` to observe it.
14
14
15
15
# C-like integers and floats are understood.
16
16
Original file line number Diff line number Diff line change 2
2
3
3
# # Inline data
4
4
5
+ # # -
6
+
5
7
# Specify data without a separate file.
6
8
7
9
# http://stackoverflow.com/questions/3318228/gnuplotting-data-without-a-textfile
8
10
11
+ # Uses the special filename `-`.
12
+
13
+ set multiplot layout 2 ,1
14
+
9
15
set key outside
10
- plot ' -' using 1 :2
16
+
17
+ plot ' -' lw 3
11
18
0 0
12
19
1 1
13
20
2 4
14
21
3 9
15
22
4 16
16
23
e
24
+
25
+ # Multiple data syntax looks like Bash EOF.
26
+ plot ' -' lw 3 , ' -' lw 3
27
+ 0 0
28
+ 1 1
29
+ 2 4
30
+ 3 9
31
+ 4 16
32
+ e
33
+ 0 0
34
+ 1 1
35
+ 2 2
36
+ 3 3
37
+ 4 4
38
+ e
39
+
40
+ unset multiplot
Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ Examples that require user to make input or wait like animations.
5
5
Put in a separate directory to avoid stalling the build.
6
6
7
7
1 . [ animation] ( animation.gnuplot )
8
+ 1 . [ size] ( size.gnuplot )
9
+ 1 . [ colormap.gif] ( colormap.gif.gnuplot )
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env gnuplot
2
+
3
+ # Artistic colormap rendering.
4
+
5
+ # Placed here because it takes a long time, and is just artistic,
6
+ # not a minimal example.
7
+
8
+ set key off
9
+ set view map
10
+ set samples 100
11
+ set isosamples 100
12
+ set xrange [ - 10 : 10 ]
13
+ set yrange [ - 10 : 10 ]
14
+ n = 100
15
+ do for [i=1 : n ] {
16
+ splot ' ++' using 1 :2 :(sin (($1 **2 + $2 **2 ) * 2 *pi*i/n)) with pm3d
17
+ }
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env gnuplot
2
+
3
+ # Maximize: http://stackoverflow.com/questions/22493766/how-to-make-gnuplot-plot-in-a-maximized-window
4
+
5
+ set terminal wxt size 1024 ,768
6
+ plot x
Original file line number Diff line number Diff line change @@ -24,9 +24,37 @@ has short form:
24
24
25
25
I recommend using the long form when scripting, and the short form for interactive sessions.
26
26
27
+ ## File extension
28
+
29
+ < http://stackoverflow.com/questions/5497889/is-there-a-standard-file-extension-for-gnuplot-files >
30
+
31
+ There are a bunch of options.
32
+
33
+ I prefer ` .gnuplot ` as it is the clearest, but it has little support.
34
+
35
+ The shebang helps Vim there.
36
+
27
37
## Source code
28
38
29
39
cvs -d:pserver:anonymous@gnuplot.cvs.sourceforge.net:/cvsroot/gnuplot login
30
40
cvs -z3 -d:pserver:anonymous@gnuplot.cvs.sourceforge.net:/cvsroot/gnuplot co -P gnuplot
41
+ cd gnuplot
42
+ cvs update -r Release_5_0_1
43
+ # Ubuntu 14.04.
44
+ sudo apt-get build-dep gnuplot
45
+ sudo apt-get install lua5.2
46
+ ./prepare
47
+ ./configure
48
+ time make
49
+ ./src/gnuplot --version
50
+ # Install is needed for it to work.
51
+ sudo make install
52
+ gnuplot --version
53
+
54
+ When you get tired of it:
55
+
56
+ sudo make uninstall
31
57
32
58
Yes, CVS on SourceForge... but remember that this is a project started in 1985 :-)
59
+
60
+ TODO: how to checkout a given version????
Original file line number Diff line number Diff line change 4
4
5
5
set key outside center right
6
6
plot \
7
- sin (x) title " my sin" ,\
8
- cos (x) title " my cos"
7
+ sin (x) + 0 title " my sin" ,\
8
+ sin (x) + 1 title " my sin + 1" ,\
9
+ sin (x) + 2 notitle
Original file line number Diff line number Diff line change 8
8
9
9
set multiplot layout 6 ,1
10
10
11
+ # Can also be done with `plot notitle` for a single plot.
11
12
set key off
12
13
plot sin (x) title " off"
13
14
Original file line number Diff line number Diff line change 69
69
70
70
# # piecewise
71
71
72
- step (x) = x> a ? 1 : 0
72
+ step (x) = x > a ? 1 : 0
73
73
p f (x)*(x<0.8 ) + g (x)*(x>=0.8 )
74
74
# disadvantage: both parts are always evaluated
75
75
83
83
84
84
pr " as" ." df"
85
85
86
- if ( 1 ) { pr " 1" }
87
- if ( 0 ) { pr " 0" }
86
+ if ( 1 ) { pr " 1" }
87
+ if ( 0 ) { pr " 0" }
88
88
89
- do for [i=1 : 5 : 2 ]{ pr i }
90
- do for [i=1 : 5 : 2 ]{ pr i }
89
+ do for [i=1 : 5 : 2 ] { pr i }
90
+ do for [i=1 : 5 : 2 ] { pr i }
91
91
92
92
# # Not possible in 4.6:
93
93
Original file line number Diff line number Diff line change
1
+ # Line
2
+ 1 1
3
+ 2 2
4
+ 3 3
5
+
6
+
7
+ # Squaree
8
+ 1 1
9
+ 2 4
10
+ 3 9
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env gnuplot
2
+
3
+ # # palette
4
+
5
+ # Represent an extra dimension with color.
6
+
7
+ # Variable point size is another option with `pointsize variable`:
8
+ # http://gnuplot.sourceforge.net/demo/pointsize.html
9
+
10
+ set key off
11
+
12
+ set multiplot layout 3 ,1
13
+
14
+ # We could also add a `using 1:2:3` here,
15
+ # but that is the default.
16
+ # TODO how to make this smooth?
17
+ plot ' -' with lines palette linewidth 3
18
+
19
+ 0 0 0
20
+ 1 1 1
21
+ 2 4 8
22
+ 3 9 27
23
+ 4 16 64
24
+ e
25
+
26
+ # This example uses the special filename '+',
27
+ # which makes x vary over the range,
28
+ # so we can define everything with functions.
29
+ plot ' +' using 1 :(sin ($1 )):($1 **2 ) with lines palette linewidth 3
30
+
31
+ # Switch between two colors only:
32
+ # http://stackoverflow.com/questions/8717805/how-to-make-points-one-color-when-a-third-column-equals-zero-and-another-color
33
+ set palette model RGB defined ( 0 ' red' , 1 ' green' )
34
+ plot ' +' using 1 :(sin ($1 )):($1 < 0 ? 0 : 1 ) palette linewidth 3
35
+
36
+ unset multiplot
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env gnuplot
2
+
3
+ # # pm3d
4
+
5
+ # # Heat maps
6
+
7
+ # Palette mapped 3D.
8
+
9
+ # Represent the third dimension as color, and fill in the entire image.
10
+
11
+ set view map
12
+ set samples 10
13
+ set isosamples 10
14
+ set xrange [ - 10 : 10 ]
15
+ set yrange [ - 10 : 10 ]
16
+ splot ' ++' using 1 :2 :($1 **2 + $2 **2 ) with pm3d
Original file line number Diff line number Diff line change 9
9
# Add a line to plotted data.
10
10
11
11
plot \
12
- " square.data" with line ,\
12
+ " square.data" with lines ,\
13
13
" line.data" w l ,
You can’t perform that action at this time.
0 commit comments