File: surface1.dem

package info (click to toggle)
gnuplot 4.0.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,396 kB
  • ctags: 6,623
  • sloc: ansic: 63,562; lisp: 5,011; cpp: 970; sh: 900; makefile: 756; objc: 647; asm: 539; csh: 297; awk: 235; pascal: 192; perl: 44
file content (216 lines) | stat: -rw-r--r-- 6,474 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#
# $Id: surface1.dem,v 1.10 2003/10/28 05:35:54 sfeam Exp $
#
set samples 21
set isosample 11
set xlabel "X axis" -3,-2
set ylabel "Y axis" 3,-2
set zlabel "Z axis" -5
set title "3D gnuplot demo"
set label 1 "This is the surface boundary" at -10,-5,150 center
set arrow 1 from -10,-5,120 to -10,0,0 nohead
set arrow 2 from -10,-5,120 to 10,0,0 nohead
set arrow 3 from -10,-5,120 to 0,10,0 nohead
set arrow 4 from -10,-5,120 to 0,-10,0 nohead
set xrange [-10:10]
set yrange [-10:10]
splot x*y
pause -1 "Hit return to continue (1)"
unset arrow
unset label
set grid
splot x**2+y**2, x**2-y**2
pause -1 "Hit return to continue (2)"
rep x*y
pause -1 "Hit return to continue (3)"
rep (x**3+y**3)/10
pause -1 "Hit return to continue (4)"
set ticslevel 0.0
set title "3D gnuplot demo ( ticslevel = 0.0 )"
rep
pause -1 "Hit return to continue (5)"
set ticslevel 2.0
set title "3D gnuplot demo ( ticslevel = 2.0 )"
rep
pause -1 "Hit return to continue (6)"
set ticslevel 0.5
set title "3D gnuplot demo ( ticslevel = 0.5 )"
rep
pause -1 "Hit return to continue (7)"
set title "3D gnuplot demo"
unset grid
splot x*y with points
pause -1 "Hit return to continue (8)"
unset xtics
unset ytics
set xrange [-1:1]
set yrange [-1:1]
set title "Surfaces with no grid or tics"
splot x*y with lines, x**2*y**3 with dots, x**3*y*2 with points
pause -1 "Hit return to continue (9)"
set xtics ("low" -3, "mid" 0, "high" 3)
set ytics -2,0.5,2
set xrange [-3:3]
set yrange [-3:3]
set log z
set title "Surfaces with z log scale"
splot x**2*y**2 + 2, x**2*y**4 + 2, x**4*y**2 + 2
pause -1 "Hit return to continue (10)"
unset log z
set xtics autofreq
set ytics autofreq
set xrange [-1:1]
set yrange [-1:1]
set samples 51
set isosample 21
set dummy u,v
set title "3D gnuplot demo"
splot u*v / (u**2 + v**2 + 0.1)
pause -1 "Hit return to continue (11)"
splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
pause -1 "Hit return to continue (12)"
set zrange [-1.0:1.0]
replot
pause -1 "Hit return to continue (13)"
set title "Sinc function"
set zrange [-1:1]
set label 1 "This is equal to 1" at 0,3.2,1 left
set arrow 1 from 0,3,1 to 0,0,1
sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2)
splot [-5:5.01] [-5:5.01] sinc(u,v)
pause -1 "Hit return to continue (14)"
set view 70,20,1
set zrange [-0.5:1.0]
set ztics -1,0.25,1
set label 1 "This is equal to 1" at -5,-2,1.5 centre
set arrow 1 from -5,-2.1,1.4 to 0,0,1
splot [-12:12.01] [-12:12.01] sinc(u,v)
pause -1 "Hit return to continue (15)"
set title "\"fence plot\" using separate parametric surfaces"
# A method suggested by Hans-Bernhard Broeker
# <broeker@physik.rwth-aachen.de>: display a separate parametric
# surface for each fence.
set zrange [-1:1]
unset label
unset arrow
set xrange [-5:5]; set yrange [-5:5]
set arrow from 5,-5,-1.2 to 5,5,-1.2 lt -1
set label 1 "increasing v" at 6,0,-1
set arrow from 5,6,-1 to 5,5,-1 lt -1
set label 2 "u=0" at 5,6.5,-1
set arrow from 5,6,sinc(5,5) to 5,5,sinc(5,5) lt -1
set label 3 "u=1" at 5,6.5,sinc(5,5)
set parametric
set hidden3d
set isosamples 2,33
xx=-5; dx=(4.99-(-4.99))/9
x0=xx; xx=xx+dx
x1=xx; xx=xx+dx
x2=xx; xx=xx+dx
x3=xx; xx=xx+dx
x4=xx; xx=xx+dx
x5=xx; xx=xx+dx
x6=xx; xx=xx+dx
x7=xx; xx=xx+dx
x8=xx; xx=xx+dx
x9=xx; xx=xx+dx
splot [u=0:1][v=-4.99:4.99] \
	x0, v, (u<0.5) ? -1 : sinc(x0,v) notitle, \
	x1, v, (u<0.5) ? -1 : sinc(x1,v) notitle, \
	x2, v, (u<0.5) ? -1 : sinc(x2,v) notitle, \
	x3, v, (u<0.5) ? -1 : sinc(x3,v) notitle, \
	x4, v, (u<0.5) ? -1 : sinc(x4,v) notitle, \
	x5, v, (u<0.5) ? -1 : sinc(x5,v) notitle, \
	x6, v, (u<0.5) ? -1 : sinc(x6,v) notitle, \
	x7, v, (u<0.5) ? -1 : sinc(x7,v) notitle, \
	x8, v, (u<0.5) ? -1 : sinc(x8,v) notitle, \
	x9, v, (u<0.5) ? -1 : sinc(x9,v) notitle
pause -1 "Hit return to continue (16)"
set title "\"fence plot\" using single parametric surface with undefined points"
# Another method suggested by Hans-Bernhard Broeker
# <broeker@physik.rwth-aachen.de>: Use parametric variable u to control
# x, y, and z.  u=3*fencenumber+remainder, where the remainder selects
# one of three types of points:
# 	  remainder=0: x=xmin+fencenumber*dx, y=v, z=zbase
# 	  remainder=1: x=xmin+fencenumber*dx, y=v, z=f(x,y)
# 	  remainder=2: x=xmin+fencenumber*dx, y=v, z=1/0 (undefined)
set parametric
unset label
unset arrow
xmin=-4.99; xmax=5; n=10; dx=(xmax-xmin)/(n-1.)
set isosamples 3*n,33
zbase=-1
set arrow from 5,-5,-1.2 to 5,5,-1.2 lt -1
set label 1 "increasing v" at 6,0,-1
set arrow from -5,-5,-1.2 to 5,-5,-1.2 lt -1
set label 2 "increasing u" at 0,-5,-1.5
set arrow from 5,6,-1 to 5,5,-1 lt -1
set label 3 "floor(u)%3=0" at 5,6.5,-1
set arrow from 5,6,sinc(5,5) to 5,5,sinc(5,5) lt -1
set label 4 "floor(u)%3=1" at 5,6.5,sinc(5,5)
splot [u=.5:3*n-.5][v=-4.99:4.99] \
	 xmin+floor(u/3)*dx, v, ((floor(u)%3)==0) ? zbase : \
			 (((floor(u)%3)==1) ? sinc(xmin+u/3.*dx,v) : 1/0) notitle
pause -1 "Hit return to continue (17)"
unset hidden3d; unset parametric; set isosamples 20,20
set xrange [-1:1]; set yrange [-1:1]
set ztics autofreq
unset arrow
unset label
set log
set auto
set title "This has logarithmic scale"
splot [x=1:15] [y=1:15] x**2+y**2
pause -1 "Hit return to continue (18)"
unset log
set xrange [0:15]
set yrange [0:15]
set auto
#set zrange [-0.6:0.7]
set ticslevel 0
set style data lines
set title "Data grid plotting"
set parametric
splot "glass.dat"
pause -1 "Hit return to continue (19)"
splot "glass.dat" using 3:2:1
pause -1 "Hit return to continue (20)"
set zrange [-1.2:1.2]
set ticslevel 0.5
unset parametric
set xlabel "line index within group"
set ylabel "group index"
splot "glass.dat" using 1, "glass.dat" using 2, "glass.dat" using 3
pause -1 "Hit return to continue (21)"
set title "splot of part of a data file"
set xlabel "X axis" -3,-2
set ylabel "Y axis" 3,-2
set hidden3d
splot 'glass.dat' every 2::0::12 with lines
pause -1 "Hit return to continue (22)"
set title "splot with \"set pm3d\" (implemented with some terminals)"
set pm3d
set hidden3d
splot 'glass.dat' every 2::0::12 with lines
pause -1 "Hit return to continue (23)"
unset hidden3d
unset pm3d
set param
set title "Test of spherical coordinates"
set mapping spherical
splot "glass.dat"
pause -1 "Hit return to continue (24)"

# mandelbrot demo
set title "Mandelbrot function"
unset parametric
set mapping cartesian
set view 60,30,1,1
set auto
set isosamples 60
set hidden3d
compl(a,b)=a*{1,0}+b*{0,1}
mand(z,a,n) = n<=0 || abs(z)>100 ? 1:mand(z*z+a,a,n-1)+1
splot [-2:1][-1.5:1.5] mand({0,0},compl(x,y),30)     
pause -1 "Hit return to continue (25)"
reset