File: graphics.html

package info (click to toggle)
euler 1.61.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 5,164 kB
  • sloc: ansic: 24,761; sh: 8,314; makefile: 141; cpp: 47; php: 1
file content (473 lines) | stat: -rw-r--r-- 23,789 bytes parent folder | download | duplicates (8)
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--last modified on Wednesday, March 28, 2001 12:18 PM -->
<HTML>

<HEAD>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<META NAME="VPSiteProject" CONTENT="file:///E|/euler/docs/Euler.vpp">

	<META NAME="GENERATOR" Content="Visual Page 2.0 for Windows">
	<TITLE>Graphics</TITLE>
	<BASE target="_self">
	<LINK REL="stylesheet" TYPE="text/css" HREF="euler.css">
</HEAD>

<BODY>

<H1 ALIGN="CENTER">Euler Graphics</H1>
<P>This long section explains

<UL>
	<LI><A HREF="#Basics">the coordinate systems</A>,
	<LI><A HREF="#Plotting a Function">a simple way to plot functions,</A>
	<LI><A HREF="#Special 3D-Plots">and functions of two variables,</A>
	<LI><A HREF="#Titles and Plot Text">how to add titles and text to your plot</A>,
	<LI><A HREF="#2D Plots">elementary 2D x-y-plots</A>,
	<LI><A HREF="#Plot Styles and Colors">how to change the line style and color of your plot,</A>
	<LI><A HREF="#Marker Plots">point plots</A>,
	<LI><A HREF="#Bar Plots">bar plots</A>,
	<LI><A HREF="#3D Plots">3D x-y-z-plots,</A>
	<LI><A HREF="#Contour and Density Plots">contour and density plots,</A>
	<LI><A HREF="#Contour and Density Plots">colored 3D plots</A>
	<li><a href="#multiplots">Easy multiplot figure</a></li>
	<LI><A HREF="#Choosing Coordinates with the Mo">how to choose coordinates from the plot with the mouse</A>.
	<li><a href="#animation">how to animate plots</a></li>
	<LI><A HREF="#Exporting">exporting and saving graphics to disk</A>
</UL>

<H2 ALIGN="CENTER"><A NAME="Basics"></A>Basics</H2>
<P>The best part of EULER is its graphics capability. There are two screens, the text screen and the graphic screen.
Text output automatically displays the text screen, and graphic output displays the graphic screen. One may also
switch to the graphic screen by pressing TAB on input or with the command</P>
<PRE>    &gt;shg;
</PRE>
<P>There are two coordinate systems. The <EM>screen coordinates</EM> are a 1024x1024 grid with (0,0) in the upper
left corner. Furthermore, each plot generates <EM>plot coordinates</EM> mapping a rectangle of the plane to the
screen with the smallest x value left and the smallest y value at the bottom. To be precise, the rectangle is mapped
to the screen &quot;window&quot;, which may only cover a part of the display area. See below for more information
on windows.
<H2 ALIGN="CENTER"><A NAME="Plotting a Function"></A>Plotting a Function or Expression</H2>
<P>We will start with a few practical functions. These functions are defined in utility files and build on more
primitive graphic routines, which we explain later. By the way, you can use</P>
<pre>    &gt;help function</pre>
<p>to get additionnal help on a function</p>
<P>The plotting of a user defined function f(x,...) can be done with</P>
<PRE>    &gt;fplot(&quot;f&quot;,a,b)
    &gt;fplot(&quot;f&quot;,a,b,n)
    &gt;fplot(&quot;f&quot;,a,b,,...)
</PRE>
<P>The extra parameters ... are passed to f. n is the number of subintervals. Note the extra ',', if n is omitted.
If a and b are omitted, as in</P>
<PRE>    &gt;fplot(&quot;f&quot;,,,,...)
</PRE>
<P>or</P>
<PRE>    &gt;fplot(&quot;f&quot;)
</PRE>
<P>then the plot coordinates of the last plot are used.</P>
<P>You can use an expression instead of a function name.</P>
<PRE>    &gt;fplot(&quot;x^2&quot;,-1,1)
</PRE>
<P>This will plot the function x^2 on the interval [-1,1].</P>
<P>You can zoom in with the mouse by</P>
<PRE>    &gt;setplotm(); fplot(&quot;f&quot;);
</PRE>
<P>This switches to the graphics screen, and you can select a square region of the screen.</P>
<H2 ALIGN="CENTER"><A NAME="Special 3D-Plots"></A>3D-Plots of Functions or Expressions</H2>
<P>A 3D-plot of a function can be done with</P>
<PRE>    &gt;f3dplot(&quot;f&quot;)
</PRE>
<P>f must be either a function name of a function f(x,y), or an expression in x and y. Additional parameters are
the x-y-range and the number of grid points in each dimension.</P>
<PRE>    &gt;f3dplot(&quot;f&quot;,xmin,xmax,ymin,ymax,nx,my)</PRE>
<P>You can get other kind of plots with</P>
<PRE>    &gt;f3d(&quot;f&quot;);
    &gt;f3dpolar(&quot;f&quot;);
    &gt;fcontour(&quot;f&quot;);
</PRE>
<P>In all cases &quot;f&quot; may be a valid EULER expression using x and y (and other global variables), or a
function. Especially nice is the function</P>
<PRE>    &gt;fcd(&quot;f&quot;)</PRE>
<P>which plots contour and density of a function. You may pass the number of grid points, the x-y-ranges and the
number of level lines as additional parameters, e.g.</P>
<PRE>    &gt;fcd(&quot;x*y&quot;,50,-2,2,-2,2,31);</PRE>
<P>This will plot the function with 50 grid points and 31 level lines in the specified x-y-range.</P>
<H2 ALIGN="CENTER"><A NAME="Titles and Plot Text"></A>Titles and Plot Text</H2>
<PRE>    &gt;title(&quot;text&quot;)
</PRE>
<P>draws a title above the plot. To label a specific position in the last plot, use</P>
<PRE>    &gt;label(&quot;text&quot;,x,y)</PRE>
<P>x and y are plot coordinates.</P>
<P>The title function uses the elementary</P>
<PRE>    &gt;ctext(&quot;text&quot;,[col,row])
</PRE>
<P>which plots the text centered at screen coordinates (col,row).</P>
<PRE>    &gt;text(&quot;text&quot;,[col,row])
</PRE>
<P>plots the text left justified. The width and height of the characters can be asked with</P>
<PRE>    &gt;textsize()
</PRE>
<P>returning the vector [width,height] in screen coordinates. There is also</P>
<PRE>    &gt;rtext(&quot;text&quot;,[col,row])
</PRE>
<P>which alignes text to the right. Vertical text can be printed with</P>
<PRE>    &gt;vtext(&quot;text&quot;,[col,row]);
</PRE>
<P>vctext would center the text vertically, and vrtext would align it at text end. The functions vutext, vcutext
and vrutext work the same way with text going from bottom up.</P>
<P>To compute from screen coordinates to plot coordinates, use</P>
<PRE>    &gt;{x,y}=fromscreen(c,r)</PRE>
<P>and for the other direction, use</P>
<PRE>    &gt;{c,r}=toscreen(x,y)</PRE>
<H2 ALIGN="CENTER"><A NAME="2D Plots"></A>2D Plots</H2>
<P>We know describe the basic built-in functions. If x and y are 1xN vectors, the function</P>
<PRE>    &gt;plot(x,y)
</PRE>
<P>connects the points (x[i],y[i]) with straight lines and plots these lines. It first clears the screen and draws
a frame around the screen window. The plot coordinates are chosen such that the plot fits exactly into the screen
window. This behavior is called autoscaling. You can set your own plot coordinates with</P>
<PRE>    &gt;setplot(xmin,xmax,ymin,ymax)
</PRE>
<P>(or setplot([...])). The autoscaling is then turned off. To turn it on again, use</P>
<PRE>    &gt;setplot()
</PRE>
<P>Force EULER to use a square coordinate window with</P>
<PRE>    &gt;keepsquare(1)
</PRE>
<P>Correspondingly keepsquare(0) will turn this off. This does not affect the physical appearance of the plot window.
But the width in the y-range will be the same as in the x-range.</P>
<PRE>    &gt;scaling(flag)
</PRE>
<P>will stop (flag=0) or resume (flag=1) the autoscaling of the next plot. If scaling is off, then the plot region
of the last plot (or the one set with setplot) is used.</P>
<P>By the way, the plot command returns the plot coordinates; i.e., a vector [xmin,xmax,ymin,ymax].</P>
<P>The screen window is a rectangle on the screen which can be set by</P>
<PRE>    &gt;window(cmin,cmax,rmin,rmax)
</PRE>
<P>(or window([...])) in screen coordinates.</P>
<P>If x is a 1xN vector and A MxN matrix,</P>
<PRE>    &gt;plot(x,A)
</PRE>
<P>plots several functions. The same is true with</P>
<PRE>    &gt;plot(B,A)
</PRE>
<P>if B is a MxN matrix. In this case, the plot is done for corresponding rows of A and B.</P>
<P>The graphic screen is cleared by the plot command. This can be turned off with</P>
<PRE>    &gt;hold on;
</PRE>
<P>or</P>
<PRE>    &gt;holding(1);
</PRE>
<P>To turn holding off,</P>
<PRE>    &gt;hold off;
</PRE>
<P>or</P>
<PRE>    &gt;holding(0);
</PRE>
<P>is used. The function holding returns the old state of the holding flag. This is a way to draw several plots
into the same frame. Combining window and holding is a way to draw several plots in several windows on the screen.</P>
<P><IMG SRC="sin1.gif" WIDTH="308" HEIGHT="222" ALIGN="BOTTOM" BORDER="0"></P>
<P>
<PRE>    &gt;xplot(x,y)
</PRE>
<P>works like plot but does also show axis grids. Actually, xplot has default parameters grid=1 and ticks=1, which
determine, if a grid is plotted and axis labeling is done. Thus</P>
<PRE>    &gt;xplot(x,y,1,0)
</PRE>
<P>does no ticks. Also</P>
<PRE>    &gt;xplot(x,y,ticks=0)
</PRE>
<P>may be used for the same purpose (see in the section about EULER <A HREF="programming.html">programming</A>
for details on default parameters).</P>
<PRE>    &gt;xplot()
</PRE>
<P>plots the axis and ticks only.</P>
<P>You may set vertical to 1, if you wish vertical axis labels for the y-axis. You should call shrinkwindow again
after doing so, because you will not need so much space to the left of the picture now. Put the command into EULER.CFG
to make it permanent (after loading UTIL). However, this does make sense only if you have chosen a small outline
font like (O)Courier at about 40 lines per page.</P>
<PRE>    &gt;xplot(z)
</PRE>
<P>will plot xplot(re(z),im(z)), if z is a complex vector.</P>
<PRE>    &gt;cplot(z)
</PRE>
<P>ca be used to plot a grid pattern, if z is a complex matrix.</P>
<PRE>    &gt;histogram(data,n)
</PRE>
<P>will plot a histogram of the data distribution. It will divide the interval into n equally spaced parts and
plot the number of d[i] in each subinterval.</P>
<P>You should use</P>
<PRE>    &gt;shrinkwindow()
</PRE>
<P>if you intend to use labels (ticks) on the axis. This leaves some space around the plot.</P>
<PRE>    &gt;fullwindow()
</PRE>
<P>resizes the plots to the full size. You may also set the x axis grids on your own with</P>
<PRE>    &gt;xgrid([x1,x2,x3,...])
</PRE>
<P>or</P>
<PRE>    &gt;xgrid([x1,x2,x3,...],f)
</PRE>
<P>the latter producing digits at the edge of the plot (ygrid(...) works respectively). Actually, these functions
are defined in UTIL.</P>
<P>To plot with logarithmic scale is not straightforward. Assume the data is t=1100 and s=1100. You first plot</P>
<PRE>    &gt;plot(t,log(s))
</PRE>
<P>Then you set the grid for both axes manually.</P>
<PRE>    &gt;xgrid(100:100:1000); 
    &gt;ticks=2^(0:9); ygrid1(log(t),t);
</PRE>
<P>So xgrid sets grids at 100,200,...,1000 and ygrid1 sets ticks at the logarithms of 2,4,8,..,512 but using the
labels 2,4,8,...,512 instead of the actual logarithmic values. This scheme allows for any scaling, not only for
logarithmic.</P>
<P>
<PRE>    &gt;plotarea(x,y)
</PRE>
<P>sets the plot area for the next plot like plot(x,y), but it does not actually plot.</P>
<PRE>    &gt;reset
</PRE>
<P>is a function in UTIL, which calls shrinkwindow, hold off and some other stuff to reset the plot coordinates
to default values.
<H2 ALIGN="CENTER"><A NAME="Plot Styles and Colors"></A>Plot Styles and Colors</H2>
<P>If a color monitor is used, EULER can produce colored plots. The plot color can be modified with</P>
<PRE>    &gt;color(n)
</PRE>
<P>where n=1 is black, and n=0 is white. Other colors depend on your system settings. The textcolor and framecolor
can be set the same way.</P>
<P>There is the possibility to use dotted and dashed lines, or even invisible lines erasing the background. This
is done with one of the commands</P>
<PRE>    &gt;style(&quot;.&quot;)
    &gt;linestyle(&quot;.&quot;)
</PRE>
<P>(&quot;-&quot; for solid lines, &quot;--&quot; for dashed lines, &quot;-&gt;&quot; for arrowed lines and &quot;i&quot;
for white lines). The function linestyle, also</P>
<PRE>    &gt;linestyle(&quot;&quot;)
</PRE>
<P>returns the previous line style. The lines can have a width greater than 0. This is set with</P>
<PRE>    &gt;linewidth(n)
</PRE>
<P>The function returns the previous setting.
<H2 ALIGN="CENTER"><A NAME="Marker Plots"></A>Marker Plots</H2>
<P>The command</P>
<PRE>    &gt;mark(x,y)
</PRE>
<P>works like plot. But it does not connect the points but plots single markers at (x[i],y[i]). The style of the
marker can be set with one of the commands</P>
<PRE>    &gt;style(&quot;mx&quot;)
    &gt;markerstyle(&quot;mx&quot;)
</PRE>
<P>for a cross. Other styles are &quot;m&lt;&gt;&quot; for diamonds, &quot;m.&quot; for dots, &quot;m+&quot; for
plus signs, &quot;m[]&quot; for rectangles and &quot;m*&quot; for stars. The function returns the previous marker
style. The markersize can be set with</P>
<PRE>    &gt;markersize(x)
</PRE>
<P>in screen coordinates (0..1024). There is also the command</P>
<PRE>    &gt;xmark(x,y)
</PRE>
<P>which works like xplot.
<H2 ALIGN="CENTER"><A NAME="Bar Plots"></A>Bar Plots</H2>
<P>A rectangle area of the screen can be filled with</P>
<PRE>    &gt;bar([xleft,yup,xright,ydown])
</PRE>
<P>The coordinates are screen coordinates. But there is the utility function</P>
<PRE>    &gt;plotbar(x,y,w,h);
</PRE>
<P>which plots in plot coordinates. The style of the bar is determined by the barcolor(c) and the barstyle(s) functions.
The color is an index from 0 to 15 and the style is a string. Available are &quot;#&quot; for solid, &quot;O#&quot;
for solid framed, &quot;#&quot; for framed, &quot;/&quot;, &quot;\&quot; and &quot;\/&quot; for hatched bars.</P>
<P>The usage of this function is a bit critical. You have to set the plot window first, then determine the x and
y of the lower left corners, finally the heights and widths of the bars. E.g.</P>
<PRE>    &gt;setplot(1,30,0,5); x=1:29; y=log(x); plotbar(x,0,1,y);</PRE>
<P>There is a function to do histograms.</P>
<PRE>    &gt;histogram(data,n)</PRE>
<P>which makes a histogram (value distribution) of the given unordered data.
<H2 ALIGN="CENTER"><A NAME="3D Plots"></A>3D Plots</H2>
<P><IMG SRC="bezier4.gif" WIDTH="292" HEIGHT="223" ALIGN="RIGHT" BORDER="0">The easiest way to produce 3D-plots
is</P>
<PRE>    &gt;mesh(Z)
</PRE>
<P>If Z is a NxM matrix, its elements are interpreted as z-values of a function defined on a grid of points (i,j).
The plot is a three dimensional plot with hidden lines of the points (i,j,Z[i,j]). It is autoscaled to fit onto
the screen window. The point (1,1,z[1,1]) is the front left point.</P>
<P>One can turn off the different fill styles mesh uses for the two sides of the plot with</P>
<PRE>    &gt;twosides(0)
</PRE>
<P>This function works also for solid plots described below. It is a faster way than the use of triangles to avoid
seeing the errors, that the mesh plot sometimes makes. By the way, both functions return the old values of the
flags.</P>
<PRE>    &gt;meshbar(Z)
</PRE>
<P>works similar as mesh, but plots the heights of Z as square columns.</P>
<P>There is a function which produces matrices X and Y such that X[i,j] and Y[i,j] are the coordinates in the plane
of a point in a rectangular grid parameterized by (i,j). This function is</P>
<PRE>    &gt;{X,Y}=field(x,y)
</PRE>
<P>where x and y are row vectors. Then X[i,j] is equal to x[i] and Y[i,j] is equal to y[j]. So you can easily generate
a matrix of function values; e.g.,</P>
<PRE>    &gt;Z=X*X+Y*Y
</PRE>
<P>However, you can do this more easily, by defining y as a column vector, x as a row vector. Then</P>
<PRE>    &gt;Z=x*x+y*y
</PRE>
<P>will work just as expected. This is due to the rules for operands, which operate on matrices. Even a more complex
expression, like x*y+3*x+y^3 would be evaluated correctly.</P>
<P>A nicer way to plot a surface is</P>
<PRE>    &gt;solid(x,y,z)
</PRE>
<P>or</P>
<PRE>    &gt;framedsolid(x,y,z)
</PRE>
<P>where x, y and z are NxM matrices. The surface parameters are then (i,j) and (x[i,j],y[i,j],z[i,j]) are points
on the surface. The function would work, if x is a row vector, y a column vector, just as an operator.</P>
<PRE>    &gt;framedsolid(x,y,z,1)</PRE>
<P>will scale the plot to fit into a cube of side length 2 (the unit cube).</P>
<P>The surface should not self intersect; or else plot errors will occur. The surface is projected onto the screen
in central projection, with the view centered to (0,0,0). You can set the viewing distance, a zooming parameter,
the angles of the eye from the negative y- to the positive x-axis, and the height of the eye on the x-y-plane,
by</P>
<PRE>    &gt;view(distance,tele,angle,height)
</PRE>
<P>(or view([...])). view returns the previous values and view() merely returns the old values. framedsolid has
a default parameter scale, which scales the image to fit into a cube with side length 2*scale, centered at 0, unless
scale=0, which is the default value (no scaling). Thus</P>
<PRE>    &gt;framedsolid(x,y,z,2)
</PRE>
<P>will scale the plot so that |x|,|y|,|z|&lt;=2.</P>
<PRE>    &gt;wire(x,y,z)
</PRE>
<P>and</P>
<PRE>    &gt;framedwire(x,y,z)
</PRE>
<P>work the same way, but the plotting is not solid. If x, y and z are vectors, then a path in three dimensions
is drawn. The color of the wires is set by</P>
<PRE>    &gt;wirecolor(c)
</PRE>
<P>If you add an extra value to framedwire or framedsolid like in</P>
<PRE>    &gt;framedwire(x,y,z,scale)
</PRE>
<P>the plot is scaled to fit into a cube of side length 2*scale. The function</P>
<PRE>    &gt;{x1,y1}=project(x,y,z)
</PRE>
<P>projects the coordinates x,y,z to the screen and is useful for labeling 3D plots. There is a function</P>
<PRE>    &gt;scalematrix(A)
</PRE>
<P>which scale the matrix A linearly so that its entries are between 0 and 1.</P>
<PRE>    &gt;solid(x,y,z,i)
</PRE>
<P>is a special form of solid. If i=[i1,...,in], then the ij-th row of (x,y,z) is not connected to the ij+1-st
row. I.e., the plot consists of n+1 parts.</P>

<P>To get a plot of a cloud of points, use one of the following</P>
<PRE>    &gt;mark3(x,y,z)
    &gt;framedmark3(x,y,z)
    &gt;framedmark3(x,y,z,scale)</PRE>
<P>x, y and z must be 1xn vectors.</P>

<P>A special feature are stereo plots. This will generate two pictures and there is a special techique to view
them as one stereo picture. You look through the image, such that there appear exactly three images, and focus.
To get a stereo wire plot, use</P>
<PRE>    &gt;stereo(&quot;framedwire&quot;,x,y,z,scale)</PRE>
<P>In general, the first parameter is the function, which does the plot, and further parameters are passed to this
function.
<H2 ALIGN="CENTER"><A NAME="Contour and Density Plots"></A>Contour and Density Plots</H2>
<P>A contour plot of a matrix is produced with</P>
<PRE>    &gt;contour(A,[v1,...,vn])
</PRE>
<P>The contour lines are then at the heights v1 to vn. The interpretation of A is the same as in mesh(A).</P>
<P>A density plot is a plot of a matrix, that uses shades to make the values visible. It can be made with</P>
<PRE>    &gt;density(A)
</PRE>
<P>The integer parts of the values are cut off. So the shades run through the available shades, if A runs from
0 to 1. A can be scaled to 0 to f with</P>
<PRE>    &gt;density(A,f)
</PRE>
<P>f=1 is the most important value. The shades can be controlled with</P>
<PRE>    &gt;huecolor(color)
</PRE>
<P>Any positive color produces shades in that color with varying intensity.</P>
<H2 ALIGN="CENTER"><A NAME="Shaded"></A>Colored plots</H2>
<P>The color 0 uses a rainbow color scheme. The color 1 is for gray scale shading.</P>
<PRE>    &gt;solidhue(x,y,z,h)
</PRE>
<P>makes a solid view with shades. h are the shading values with the same interpretation as in density. Thus h
must be a matrix of the same size as x, y and z. Each point h[i,j] controls the color at the grid point (x[i,j],y[i,j],z[i,j]).</P>
<PRE>    &gt;framedsolidhue(x,y,z,h,scale,f)
</PRE>
<P>works like a mixture of framedsolid and solidhue. scale=0 and f=1 are the default values.
<h2 align="center"><a name="multiplots">Easy multiplot figure</a></h2>
<p>multiplots figure can easily be obtained using the <tt>figure</tt> command.
<pre>    &gt;figure([1,2]);</pre>
<p>defines a figure with one row of plots and two columns. The function sets
the screen window so that you can draw the first plot (top-left). For the
second one, just write</p>
<pre>    &gt;figure(2);</pre>
<p>Then, plot your second function, and so on ... Plots are numbered from left
to right, starting with the first row. The <tt>figure</tt> command uses the
holding feature of the graphical screen to achieve the multiplot functionnality.
So, you have to use</p>
<pre>    &gt;hold off;</pre>
<p>to be able to clear the previous plots. You may need to call <tt>shrinkwindow()</tt>
to have a common full screen plot, as well.
<H2 ALIGN="CENTER"><A NAME="Choosing Coordinates with the Mo"></A>Choosing Coordinates with the Mouse</H2>
<P>It is possible to sample coordinates from the graphics screen with the mouse.</P>
<PRE>    &gt;mouse()
</PRE>
<P>displays the graphics screen and a mouse pointer and waits for a mouse click. It returns a vector [x,y] which
are the plot coordinates of the clicked spot. Using</P>
<PRE>    &gt;{x,y}=select()
</PRE>
<P>returns several x coordinates and y coordinates at the points, which the user selected by the mouse. The selection
stops, if the user clicks above the plot window.</P>
<H2 ALIGN="CENTER"><A NAME="animation"></A>How to Animate Plots</H2>
<p>The animation scheme used here is slightly different than the Window's one, but it is simpler as well.
Animation is made of a sequence of plots (any plot type) recorded, and that
can be relayed.</p>
<p>To start recording a plot sequence, use</p>
<pre>    &gt;beginpages();</pre>
<p>Draw the first frame. Each time the <tt>clg</tt> command (clear graphics) is
called, a new frame is created. This is what happens when you simply call
<tt>xplot</tt>. To end recording, use</p>
<pre>    &gt;endpages();</pre>
<p>To replay the sequence, use</p>
<pre>    &gt;playpages(delay);</pre>
<p>where <tt>delay</tt> is the time between consecutive frames. The function
returns the number of frames.</p>
<p>You can also the number of pages of the animation using</p>
<pre>    &gt;pages();</pre>
<p>While recording nothing is drawn on the graphical window. After the end of a
recording, the animation is deleted whenyou plot another function or when you
clear the graphical screen.</p>
<p>Here is an example that showing a curve evolution when the parameter k changes from 1 to 10.</p>
<pre>    &gt;function record()
    $  x=-4:0.1:4;
    $  beginpages();
    $  for k=1 to 10 .. plot a sequence of 10 plots
    $    xplot(x,x^3+k*x^2-k*x);
    $  end
    $  return endpages();
    $endfunction
    &gt;record();
    &gt;playpages(0.2);</pre>
<p>For more details on creating functions, see the programminf section in this
manual. <tt>playpages</tt> runs the animation once. To show the animation in an
endless loop, use</p>
<pre>    &gt;animate(0.2);</pre>
<p>The loop can be broken by a key stroke.</p>
<p>3d animation can be quickly set up, using</p>
<pre>    &gt;rotate(&quot;f3dplot&quot;;&quot;x*y&quot;);</pre>
<p>Note the use of the <span lang="en-us">semicolon</span>.
<H2 ALIGN="CENTER"><A NAME="Exporting"></A>Exporting and Saving Graphics</H2>
<P>All Euler version can save graphics in Encapsulated Postscript (EPS) format, a feature, which has been programmed
by Eric Bouchar&eacute;. The Windows version can export Windows Metafiles to the clipboard, and save Windows bitmaps
on disk. Moreover, there is a special Euler metafile format, which might be used for external filters. It is documented
in the source code of Euler.</P>
<P>To use the postscript export, there is the command</P>
<PRE>    &gt;postscript &quot;filename.ps&quot;</PRE>
<P>This command will overwrite any existing file with this name. The size of the Postscript screen can be set with</P>
<PRE>    &gt;pswindow([width,height])</PRE>
<P>The default is 15x15 cm.</P>
<P>You can save the graphics screen in the internal Euler metafile format with the command</P>
<PRE>    &gt;meta &quot;filename.met&quot;</PRE>

</BODY>

</HTML>