2 # $Id: surface1.dem,v 1.11 2004/09/17 05:01:12 sfeam Exp $
6 set xlabel "X axis" offset -3,-2
7 set ylabel "Y axis" offset 3,-2
8 set zlabel "Z axis" offset -5
9 set title "3D gnuplot demo"
10 set label 1 "This is the surface boundary" at -10,-5,150 center
11 set arrow 1 from -10,-5,120 to -10,0,0 nohead
12 set arrow 2 from -10,-5,120 to 10,0,0 nohead
13 set arrow 3 from -10,-5,120 to 0,10,0 nohead
14 set arrow 4 from -10,-5,120 to 0,-10,0 nohead
18 pause -1 "Hit return to continue (1)"
22 splot x**2+y**2, x**2-y**2
23 pause -1 "Hit return to continue (2)"
25 pause -1 "Hit return to continue (3)"
27 pause -1 "Hit return to continue (4)"
29 set title "3D gnuplot demo ( ticslevel = 0.0 )"
31 pause -1 "Hit return to continue (5)"
33 set title "3D gnuplot demo ( ticslevel = 2.0 )"
35 pause -1 "Hit return to continue (6)"
37 set title "3D gnuplot demo ( ticslevel = 0.5 )"
39 pause -1 "Hit return to continue (7)"
40 set title "3D gnuplot demo"
43 pause -1 "Hit return to continue (8)"
48 set title "Surfaces with no grid or tics"
49 splot x*y with lines, x**2*y**3 with dots, x**3*y*2 with points
50 pause -1 "Hit return to continue (9)"
51 set xtics ("low" -3, "mid" 0, "high" 3)
56 set title "Surfaces with z log scale"
57 splot x**2*y**2 + 2, x**2*y**4 + 2, x**4*y**2 + 2
58 pause -1 "Hit return to continue (10)"
67 set title "3D gnuplot demo"
68 splot u*v / (u**2 + v**2 + 0.1)
69 pause -1 "Hit return to continue (11)"
70 splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
71 pause -1 "Hit return to continue (12)"
74 pause -1 "Hit return to continue (13)"
75 set title "Sinc function"
77 set label 1 "This is equal to 1" at 0,3.2,1 left
78 set arrow 1 from 0,3,1 to 0,0,1
79 sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2)
80 splot [-5:5.01] [-5:5.01] sinc(u,v)
81 pause -1 "Hit return to continue (14)"
85 set label 1 "This is equal to 1" at -5,-2,1.5 centre
86 set arrow 1 from -5,-2.1,1.4 to 0,0,1
87 splot [-12:12.01] [-12:12.01] sinc(u,v)
88 pause -1 "Hit return to continue (15)"
89 set title "\"fence plot\" using separate parametric surfaces"
90 # A method suggested by Hans-Bernhard Broeker
91 # <broeker@physik.rwth-aachen.de>: display a separate parametric
92 # surface for each fence.
96 set xrange [-5:5]; set yrange [-5:5]
97 set arrow from 5,-5,-1.2 to 5,5,-1.2 lt -1
98 set label 1 "increasing v" at 6,0,-1
99 set arrow from 5,6,-1 to 5,5,-1 lt -1
100 set label 2 "u=0" at 5,6.5,-1
101 set arrow from 5,6,sinc(5,5) to 5,5,sinc(5,5) lt -1
102 set label 3 "u=1" at 5,6.5,sinc(5,5)
106 xx=-5; dx=(4.99-(-4.99))/9
117 splot [u=0:1][v=-4.99:4.99] \
118 x0, v, (u<0.5) ? -1 : sinc(x0,v) notitle, \
119 x1, v, (u<0.5) ? -1 : sinc(x1,v) notitle, \
120 x2, v, (u<0.5) ? -1 : sinc(x2,v) notitle, \
121 x3, v, (u<0.5) ? -1 : sinc(x3,v) notitle, \
122 x4, v, (u<0.5) ? -1 : sinc(x4,v) notitle, \
123 x5, v, (u<0.5) ? -1 : sinc(x5,v) notitle, \
124 x6, v, (u<0.5) ? -1 : sinc(x6,v) notitle, \
125 x7, v, (u<0.5) ? -1 : sinc(x7,v) notitle, \
126 x8, v, (u<0.5) ? -1 : sinc(x8,v) notitle, \
127 x9, v, (u<0.5) ? -1 : sinc(x9,v) notitle
128 pause -1 "Hit return to continue (16)"
129 set title "\"fence plot\" using single parametric surface with undefined points"
130 # Another method suggested by Hans-Bernhard Broeker
131 # <broeker@physik.rwth-aachen.de>: Use parametric variable u to control
132 # x, y, and z. u=3*fencenumber+remainder, where the remainder selects
133 # one of three types of points:
134 # remainder=0: x=xmin+fencenumber*dx, y=v, z=zbase
135 # remainder=1: x=xmin+fencenumber*dx, y=v, z=f(x,y)
136 # remainder=2: x=xmin+fencenumber*dx, y=v, z=1/0 (undefined)
140 xmin=-4.99; xmax=5; n=10; dx=(xmax-xmin)/(n-1.)
141 set isosamples 3*n,33
143 set arrow from 5,-5,-1.2 to 5,5,-1.2 lt -1
144 set label 1 "increasing v" at 6,0,-1
145 set arrow from -5,-5,-1.2 to 5,-5,-1.2 lt -1
146 set label 2 "increasing u" at 0,-5,-1.5
147 set arrow from 5,6,-1 to 5,5,-1 lt -1
148 set label 3 "floor(u)%3=0" at 5,6.5,-1
149 set arrow from 5,6,sinc(5,5) to 5,5,sinc(5,5) lt -1
150 set label 4 "floor(u)%3=1" at 5,6.5,sinc(5,5)
151 splot [u=.5:3*n-.5][v=-4.99:4.99] \
152 xmin+floor(u/3)*dx, v, ((floor(u)%3)==0) ? zbase : \
153 (((floor(u)%3)==1) ? sinc(xmin+u/3.*dx,v) : 1/0) notitle
154 pause -1 "Hit return to continue (17)"
155 unset hidden3d; unset parametric; set isosamples 20,20
156 set xrange [-1:1]; set yrange [-1:1]
162 set title "This has logarithmic scale"
163 splot [x=1:15] [y=1:15] x**2+y**2
164 pause -1 "Hit return to continue (18)"
169 #set zrange [-0.6:0.7]
172 set title "Data grid plotting"
175 pause -1 "Hit return to continue (19)"
176 splot "glass.dat" using 3:2:1
177 pause -1 "Hit return to continue (20)"
178 set zrange [-1.2:1.2]
181 set xlabel "line index within group"
182 set ylabel "group index"
183 splot "glass.dat" using 1, "glass.dat" using 2, "glass.dat" using 3
184 pause -1 "Hit return to continue (21)"
185 set title "splot of part of a data file"
186 set xlabel "X axis" offset -3,-2
187 set ylabel "Y axis" offset 3,-2
189 splot 'glass.dat' every 2::0::12 with lines
190 pause -1 "Hit return to continue (22)"
191 set title "splot with \"set pm3d\" (implemented with some terminals)"
194 splot 'glass.dat' every 2::0::12 with lines
195 pause -1 "Hit return to continue (23)"
199 set title "Test of spherical coordinates"
200 set mapping spherical
202 pause -1 "Hit return to continue (24)"
205 set title "Mandelbrot function"
207 set mapping cartesian
212 compl(a,b)=a*{1,0}+b*{0,1}
213 mand(z,a,n) = n<=0 || abs(z)>100 ? 1:mand(z*z+a,a,n-1)+1
214 splot [-2:1][-1.5:1.5] mand({0,0},compl(x,y),30)
215 pause -1 "Hit return to continue (25)"