|
17 | 17 | y_3d = (np.cos(ph) * np.sin(th)) .ravel() |
18 | 18 | z_3d = (np.sin(ph) * np.ones( th.shape )) .ravel() |
19 | 19 |
|
20 | | -sleep_interval = 1 |
21 | 20 |
|
22 | 21 |
|
23 | 22 |
|
|
29 | 28 |
|
30 | 29 | # first, some very basic stuff. Testing implicit domains, multiple curves in |
31 | 30 | # arguments, packed broadcastable data, etc |
32 | | -gp.plot(x**2) |
33 | | -time.sleep(sleep_interval) |
34 | | -gp.plot(-x, x**3) |
35 | | -time.sleep(sleep_interval) |
36 | | -gp.plot((x**2)) |
37 | | -time.sleep(sleep_interval) |
38 | | -gp.plot((-x, x**3, {'with': 'lines'}), (x**2,)) |
39 | | -time.sleep(sleep_interval) |
40 | | -gp.plot( x, np.vstack((x**3, x**2)) ) |
41 | | -time.sleep(sleep_interval) |
42 | | -gp.plot( np.vstack((-x**3, x**2)), _with='lines' ) |
43 | | -time.sleep(sleep_interval) |
44 | | -gp.plot( (np.vstack((x**3, -x**2)), {'with': 'points'} )) |
45 | | -time.sleep(sleep_interval) |
| 31 | +gp.plot(x**2, wait=1) |
| 32 | +gp.plot(-x, x**3, wait=1) |
| 33 | +gp.plot((x**2), wait=1) |
| 34 | +gp.plot((-x, x**3, {'with': 'lines'}), (x**2,), wait=1) |
| 35 | +gp.plot( x, np.vstack((x**3, x**2)) , wait=1) |
| 36 | +gp.plot( np.vstack((-x**3, x**2)), _with='lines' , wait=1) |
| 37 | +gp.plot( (np.vstack((x**3, -x**2)), {'with': 'points'} ), wait=1) |
46 | 38 |
|
47 | 39 | ################################# |
48 | 40 | # some more varied plotting, using the object-oriented interface |
49 | 41 | plot1 = gp.gnuplotlib(_with = 'linespoints', |
50 | 42 | xmin = -10, |
51 | | - title = 'Error bars and other things') |
| 43 | + title = 'Error bars and other things', |
| 44 | + wait = 1) |
52 | 45 |
|
53 | 46 | plot1.plot( ( np.vstack((x, x*2, x*3)), x**2 - 300, |
54 | 47 | {'with': 'lines lw 4', |
|
63 | 56 | {"with": 'lines', |
64 | 57 | 'legend': 'shifted cubics', |
65 | 58 | 'tuplesize': 2})) |
66 | | -time.sleep(sleep_interval) |
67 | 59 |
|
68 | 60 | ################################# |
69 | 61 |
|
|
75 | 67 | gp.plot( x**2, np.abs(x)/2, x*50, |
76 | 68 | cbrange = '-600:600', |
77 | 69 | _with = 'points pointtype 7 pointsize variable palette', |
78 | | - tuplesize = 4 ) |
79 | | -time.sleep(sleep_interval) |
| 70 | + tuplesize = 4, |
| 71 | + wait = 1) |
80 | 72 |
|
81 | 73 | # labels |
82 | 74 | gp.plot(np.arange(5),np.arange(5)+1, |
83 | 75 | np.array( ['{} {}'.format(x,x+1) for x in range(5)], dtype=str), |
84 | | - _with='labels', tuplesize=3, ascii=1) |
85 | | -time.sleep(sleep_interval) |
| 76 | + _with='labels', tuplesize=3, ascii=1, |
| 77 | + wait = 1) |
86 | 78 |
|
87 | 79 | # Conchoids of de Sluze. Broadcasting example |
88 | 80 | theta = np.linspace(0, 2*np.pi, 1000) # dim=( 1000,) |
|
94 | 86 | set = 'polar', |
95 | 87 | square = True, |
96 | 88 | yrange = [-5,5], |
97 | | - legend = a.ravel() ) |
98 | | -time.sleep(sleep_interval) |
| 89 | + legend = a.ravel(), |
| 90 | + wait = 1) |
99 | 91 |
|
100 | 92 |
|
101 | 93 | ################################ |
|
107 | 99 | _with = 'points', |
108 | 100 | title = 'sphere', |
109 | 101 | square = True, |
110 | | - legend = 'sphere') |
111 | | -time.sleep(sleep_interval) |
| 102 | + legend = 'sphere', |
| 103 | + wait = 1) |
112 | 104 |
|
113 | 105 | # sphere, ellipse together |
114 | 106 | gp.plot3d( (x_3d * np.array([[1,2]]).T, |
|
118 | 110 |
|
119 | 111 | title = 'sphere, ellipse', |
120 | 112 | square = True, |
121 | | - _with = 'points') |
122 | | -time.sleep(sleep_interval) |
| 113 | + _with = 'points', |
| 114 | + wait = 1) |
123 | 115 |
|
124 | 116 |
|
125 | 117 | # similar, written to a png |
|
131 | 123 | title = 'sphere, ellipse', |
132 | 124 | square = True, |
133 | 125 | _with = 'points', |
134 | | - hardcopy = 'spheres.png') |
135 | | -time.sleep(sleep_interval) |
| 126 | + hardcopy = 'spheres.png', |
| 127 | + wait = 1) |
136 | 128 |
|
137 | 129 |
|
138 | 130 |
|
|
144 | 136 | (-z, {'legend': 'zminus'}), |
145 | 137 | (z*2, {'legend': 'zplus2'}), |
146 | 138 |
|
147 | | - _with = 'points', title = 'gridded paraboloids', ascii=True) |
148 | | -time.sleep(sleep_interval) |
| 139 | + _with = 'points', title = 'gridded paraboloids', ascii=True, |
| 140 | + wait = 1) |
149 | 141 |
|
150 | 142 | # 3d, variable color, variable pointsize |
151 | 143 | th = np.linspace(0, 6*np.pi, 200) |
|
159 | 151 |
|
160 | 152 | title = 'double helix', |
161 | 153 | tuplesize = 5, |
162 | | - _with = 'points pointsize variable pointtype 7 palette' ) |
163 | | -time.sleep(sleep_interval) |
| 154 | + _with = 'points pointsize variable pointtype 7 palette', |
| 155 | + wait = 1) |
164 | 156 |
|
165 | 157 |
|
166 | 158 | # implicit domain heat map |
|
169 | 161 | gp.plot3d(z, |
170 | 162 | title = 'Paraboloid heat map', |
171 | 163 | set = 'view map', |
172 | | - _with = 'image') |
173 | | -time.sleep(sleep_interval) |
| 164 | + _with = 'image', |
| 165 | + wait = 1) |
174 | 166 |
|
175 | 167 | # same, but as a 2d gp.plot, _with a curve drawn on top for good measure |
176 | 168 | x,y = np.ogrid[-10:11, -10:11] |
|
187 | 179 | xmin = 0, |
188 | 180 | xmax = 20, |
189 | 181 | ymin = 0, |
190 | | - ymax = 20 ) |
191 | | -time.sleep(sleep_interval) |
| 182 | + ymax = 20, |
| 183 | + wait = 1) |
192 | 184 |
|
193 | 185 |
|
194 | 186 |
|
|
207 | 199 | square = 1, |
208 | 200 | tuplesize = 3, |
209 | 201 | _with = 'points palette pt 7', |
210 | | - ascii = False) |
211 | | -time.sleep(sleep_interval) |
| 202 | + ascii = False, |
| 203 | + wait = 1) |
212 | 204 |
|
213 | 205 | # 4d matrix curve |
214 | 206 | gp.plot(z, x, |
215 | 207 | title = '4D matrix plot. Binary.', |
216 | 208 | square = 1, |
217 | 209 | tuplesize = 4, |
218 | 210 | _with = 'points palette ps variable pt 7', |
219 | | - ascii = False) |
220 | | -time.sleep(sleep_interval) |
| 211 | + ascii = False, |
| 212 | + wait = 1) |
221 | 213 |
|
222 | 214 | # Using broadcasting to plot each slice with a different style |
223 | 215 | gp.plot((np.rollaxis( np.dstack((x,z)), 2,0), |
|
226 | 218 |
|
227 | 219 | title = 'Two 3D matrix plots. Binary.', |
228 | 220 | square = 1, |
229 | | - ascii = False) |
230 | | -time.sleep(sleep_interval) |
| 221 | + ascii = False, |
| 222 | + wait = 1) |
231 | 223 |
|
232 | 224 | # # Gnuplot doesn't support this |
233 | 225 | # gp.plot(z, x, |
234 | 226 | # title = '4D matrix plot. Binary.', |
235 | 227 | # square = 1, |
236 | 228 | # tuplesize = 4, |
237 | 229 | # _with = 'points palette ps variable pt 7', |
238 | | -# ascii = True) |
239 | | -# time.sleep(sleep_interval) |
240 | | - |
| 230 | +# ascii = True, |
| 231 | +# wait = 1) |
| 232 | +# |
241 | 233 | # 2 3d matrix curves |
242 | 234 | gp.plot((np.rollaxis( np.dstack((x,z)), 2,0), |
243 | 235 | {'tuplesize': 3, |
244 | 236 | 'with': np.array(('points palette pt 7','points ps variable pt 6'))}), |
245 | 237 |
|
246 | 238 | title = 'Two 3D matrix plots. Binary.', |
247 | 239 | square = 1, |
248 | | - ascii = True) |
249 | | -time.sleep(sleep_interval) |
| 240 | + ascii = True, |
| 241 | + wait = 1) |
250 | 242 |
|
251 | 243 | ################################### |
252 | 244 | # fancy contours just because I can |
|
267 | 259 | 'unset grid', |
268 | 260 | 'unset surface', |
269 | 261 | 'set view 0,0'], |
270 | | - square = 1 ) |
271 | | -time.sleep(sleep_interval) |
| 262 | + square = 1, |
| 263 | + wait = 1) |
272 | 264 |
|
273 | 265 |
|
274 | 266 | ################################ |
|
0 commit comments