Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / surface1.dem
1 #
2 # $Id: surface1.dem,v 1.11 2004/09/17 05:01:12 sfeam Exp $
3 #
4 set samples 21
5 set isosample 11
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
15 set xrange [-10:10]
16 set yrange [-10:10]
17 splot x*y
18 pause -1 "Hit return to continue (1)"
19 unset arrow
20 unset label
21 set grid
22 splot x**2+y**2, x**2-y**2
23 pause -1 "Hit return to continue (2)"
24 rep x*y
25 pause -1 "Hit return to continue (3)"
26 rep (x**3+y**3)/10
27 pause -1 "Hit return to continue (4)"
28 set ticslevel 0.0
29 set title "3D gnuplot demo ( ticslevel = 0.0 )"
30 rep
31 pause -1 "Hit return to continue (5)"
32 set ticslevel 2.0
33 set title "3D gnuplot demo ( ticslevel = 2.0 )"
34 rep
35 pause -1 "Hit return to continue (6)"
36 set ticslevel 0.5
37 set title "3D gnuplot demo ( ticslevel = 0.5 )"
38 rep
39 pause -1 "Hit return to continue (7)"
40 set title "3D gnuplot demo"
41 unset grid
42 splot x*y with points
43 pause -1 "Hit return to continue (8)"
44 unset xtics
45 unset ytics
46 set xrange [-1:1]
47 set yrange [-1:1]
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)
52 set ytics -2,0.5,2
53 set xrange [-3:3]
54 set yrange [-3:3]
55 set log z
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)"
59 unset log z
60 set xtics autofreq
61 set ytics autofreq
62 set xrange [-1:1]
63 set yrange [-1:1]
64 set samples 51
65 set isosample 21
66 set dummy u,v
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)"
72 set zrange [-1.0:1.0]
73 replot
74 pause -1 "Hit return to continue (13)"
75 set title "Sinc function"
76 set zrange [-1:1]
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)"
82 set view 70,20,1
83 set zrange [-0.5:1.0]
84 set ztics -1,0.25,1
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.
93 set zrange [-1:1]
94 unset label
95 unset arrow
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)
103 set parametric
104 set hidden3d
105 set isosamples 2,33
106 xx=-5; dx=(4.99-(-4.99))/9
107 x0=xx; xx=xx+dx
108 x1=xx; xx=xx+dx
109 x2=xx; xx=xx+dx
110 x3=xx; xx=xx+dx
111 x4=xx; xx=xx+dx
112 x5=xx; xx=xx+dx
113 x6=xx; xx=xx+dx
114 x7=xx; xx=xx+dx
115 x8=xx; xx=xx+dx
116 x9=xx; xx=xx+dx
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)
137 set parametric
138 unset label
139 unset arrow
140 xmin=-4.99; xmax=5; n=10; dx=(xmax-xmin)/(n-1.)
141 set isosamples 3*n,33
142 zbase=-1
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]
157 set ztics autofreq
158 unset arrow
159 unset label
160 set log
161 set auto
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)"
165 unset log
166 set xrange [0:15]
167 set yrange [0:15]
168 set auto
169 #set zrange [-0.6:0.7]
170 set ticslevel 0
171 set style data lines
172 set title "Data grid plotting"
173 set parametric
174 splot "glass.dat"
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]
179 set ticslevel 0.5
180 unset parametric
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
188 set hidden3d
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)"
192 set pm3d
193 set hidden3d
194 splot 'glass.dat' every 2::0::12 with lines
195 pause -1 "Hit return to continue (23)"
196 unset hidden3d
197 unset pm3d
198 set param
199 set title "Test of spherical coordinates"
200 set mapping spherical
201 splot "glass.dat"
202 pause -1 "Hit return to continue (24)"
203
204 # mandelbrot demo
205 set title "Mandelbrot function"
206 unset parametric
207 set mapping cartesian
208 set view 60,30,1,1
209 set auto
210 set isosamples 60
211 set hidden3d
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)"
216 reset