Icons are changed
[gnuplot] / demo / contours.dem
1 #
2 # $Id: contours.dem,v 1.13 2006/06/25 17:24:32 sfeam Exp $
3 #
4 set samples 20
5 set isosamples 21
6 set xlabel "X axis"
7 set ylabel "Y axis"
8 set zlabel "Z axis" offset 1, 0
9 set view 60, 30, 0.85, 1.1
10 set title "3D gnuplot demo - contour plot"
11 set contour
12 splot x*y
13 pause -1 "Hit return to continue (1)"
14 set cntrparam levels 20
15 set title "3D gnuplot demo - contour plot (more contours)"
16 replot
17 pause -1 "Hit return to continue (2)"
18 set cntrparam levels incr -100,10,100
19 set title "3D gnuplot demo - contour plot (every 10, starting at -100)"
20 replot
21 pause -1 "Hit return to continue (3)"
22 set cntrparam levels disc -75,-50,0
23 set title "3D gnuplot demo - contour plot (at -75, -50, 0)"
24 replot
25 pause -1 "Hit return to continue (4)"
26 set cntrparam levels auto 10
27 set title "3D gnuplot demo - contour plot on base grid"
28 set contour base
29 splot x**2-y**2
30 pause -1 "Hit return to continue (5)"
31 set title "3D gnuplot demo - contour plot on surface"
32 set contour surface
33 replot
34 pause -1 "Hit return to continue (6)"
35 set title "3D gnuplot demo - contour plot on both"
36 set contour both
37 replot
38 pause -1 "Hit return to continue (7)"
39 set contour base
40 set title "3D gnuplot demo - 2 surfaces"
41 splot x**2*y**3, x**3*y**2
42 pause -1 "Hit return to continue (8)"
43 set title "3D gnuplot demo - some more interesting contours"
44 splot x*y / (x**2 + y**2 + 0.1)
45 pause -1 "Hit return to continue (9)"
46 splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
47 pause -1 "Hit return to continue (10)"
48 set zrange [-1.0:1.0]
49 replot
50 pause -1 "Hit return to continue (11)"
51 set samples 6
52 set isosamples 6
53 set cntrparam levels 5
54 set title "3D gnuplot demo - low resolution (6x6)"
55 replot
56 pause -1 "Hit return to continue (12)"
57 set cntrparam bspline
58 set title "3D gnuplot demo - low resolution (6x6) using bspline approx."
59 replot
60 pause -1 "Hit return to continue (13)"
61 set cntrparam order 8
62 set title "3D gnuplot demo - low resolution (6x6) raise bspline order."
63 replot
64 pause -1 "Hit return to continue (14)"
65 set cntrparam linear
66 set auto
67 set title "3D gnuplot demo - low resolution (6x6) using linear contours."
68 splot x*y
69 pause -1 "Hit return to continue (15)"
70 set cntrparam order 4
71 set cntrparam bspline
72 set title "3D gnuplot demo - low resolution (6x6) using bspline approx."
73 replot
74 pause -1 "Hit return to continue (16)"
75 set samples 25
76 set isosamples 26
77 set title "3D gnuplot demo - contour of Sinc function"
78 splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
79 pause -1 "Hit return to continue (17)"
80 splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
81 pause -1 "Hit return to continue (18)"
82 set cntrparam levels 10
83 set auto
84 set zrange [-1.0:1.0]
85 set style data lines
86 set title "3D gnuplot demo - contour of data grid plotting"
87 set parametric
88 splot "glass.dat"
89 pause -1 "Hit return to continue (19)"
90 set xrange [0:15]
91 set yrange [0:15]
92 set zrange [-1.2:1.2]
93 unset parametric
94 splot "glass.dat" using 1
95 pause -1 "Hit return to continue (20)"
96 set view map
97 unset surface
98 set title "3D gnuplot demo - 2D contour projection of last plot"
99 replot
100 pause -1 "Hit return to continue (21)"
101
102 #From: shen@athena.cs.uga.edu (Mingzuo Shen)
103 #Subject: Rosenbrock's function: some answers and thanks
104 #Date: Wed, 23 Jun 1993 20:50:36 GMT
105 #
106 #    Last night I asked for help with a contour plot for the function:
107 #
108 #    (1-x)**2 + 100 * (y - x**2)**2
109 #
110 #which should have a minimum at (x=1,y=1). This is the 2D case of a more
111 #general function named after Rosenbrock (the book I am reading does not
112 #give a reference to any paper/book by this person):
113 #
114 #    for even integer n,
115 #
116 #    f(x) = \sum_{j=1,3,5,\ldots,n} [(1 - x_j)^2 + 100(x_{j+1} - x_j^2)^2]
117 #
118 #where x is a vector (x1, x2, ..., x_n). This function also have a minimum
119 #at (1,1,...,1), which lies at the base of a "banana-shaped valley".
120 #Here are the new commands I have tried.
121 #
122 set auto
123 set surface
124 unset contour
125 set cntrparam levels 5
126 set cntrparam linear
127 set samples 100
128 set logscale z
129 set hidden3d
130 set isosamples 20
131 set view 70,335,1,1
132 set xlabel "x"
133 set ylabel "y"
134 set title "Rosenbrock Function"
135 splot [0.9:1.1] [0.9:1.1] (1-x)**2 + 100*(y - x**2)**2
136 pause -1 "Hit Return to Continue (22)"
137
138 set logscale z
139 set hidden3d
140 set isosamples 60
141 set ticslevel 0.
142 set view 20,340 #HBB: ,1,2
143 set xlabel "x"
144 set ylabel "y"
145 splot [-1.5:1.5] [-0.5:1.5] (1-x)**2 + 100*(y - x**2)**2
146 pause -1 "Hit Return to Continue (23)"
147 set contour
148 unset surface
149 unset ztics
150 unset zlabel
151 set border 15
152 replot
153 pause -1 "Hit Return to Continue (24)"
154 #
155 set title "All contours drawn in a single color"
156 unset clabel
157 splot [-1.5:1.5] [-0.5:1.5] (1-x)**2 + 100*(y - x**2)**2 with lines lc rgb "#007700"
158 pause -1 "Hit Return to Continue (25)"
159 #
160 # Clean up:
161 #
162 reset