| 1 |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Plotagem</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Manual do Genius"><link rel="up" href="ch11.html" title="Chapter 11. List of GEL functions"><link rel="prev" href="ch11s19.html" title="Operações simbólicas"><link rel="next" href="ch12.html" title="Chapter 12. Example Programs in GEL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Plotagem</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s19.html">Prev</a> </td><th width="60%" align="center">Chapter 11. List of GEL functions</th><td width="20%" align="right"> <a accesskey="n" href="ch12.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-function-list-plotting"></a>Plotagem</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span lang="en" class="term"><a name="gel-function-ExportPlot"></a>ExportPlot</span></dt><dd><pre lang="en" class="synopsis">ExportPlot (file,type)</pre><pre lang="en" class="synopsis">ExportPlot (file)</pre><p lang="en"> |
| 2 |
Export the contents of the plotting window to a file. |
| 3 |
The type is a string that specifies the file type to |
| 4 |
use, "png", "eps", or "ps". If the type is not |
| 5 |
specified, then it is taken to be the extension, in |
| 6 |
which case the extension must be ".png", ".eps", or ".ps". |
| 7 |
</p><p lang="en"> |
| 8 |
Note that files are overwritten without asking. |
| 9 |
</p><p lang="en"> |
| 10 |
On successful export, true is returned. Otherwise |
| 11 |
error is printed and exception is raised. |
| 12 |
</p><p lang="en"> |
| 13 |
Examples: |
| 14 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>ExportPlot("file.png")</code></strong> |
| 15 |
<code class="prompt">genius></code> <strong class="userinput"><code>ExportPlot("/directory/file","eps")</code></strong> |
| 16 |
</pre><p lang="en"> |
| 17 |
</p><p lang="en">Version 1.0.16 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlot"></a>LinePlot</span></dt><dd><pre lang="en" class="synopsis">LinePlot (func1,func2,func3,...)</pre><pre lang="en" class="synopsis">LinePlot (func1,func2,func3,x1,x2)</pre><pre lang="en" class="synopsis">LinePlot (func1,func2,func3,x1,x2,y1,y2)</pre><pre lang="en" class="synopsis">LinePlot (func1,func2,func3,[x1,x2])</pre><pre lang="en" class="synopsis">LinePlot (func1,func2,func3,[x1,x2,y1,y2])</pre><p lang="en"> |
| 18 |
Plot a function (or several functions) with a line. |
| 19 |
First (up to 10) arguments are functions, then optionally |
| 20 |
you can specify the limits of the plotting window as |
| 21 |
<code class="varname">x1</code>, <code class="varname">x2</code>, |
| 22 |
<code class="varname">y1</code>, <code class="varname">y2</code>. If limits are not |
| 23 |
specified, then the currently set limits apply |
| 24 |
(See <a class="link" href="ch11s03.html#gel-function-LinePlotWindow"><code class="function">LinePlotWindow</code></a>) |
| 25 |
If the y limits are not specified, then the functions are computed and then the maxima and minima |
| 26 |
are used. |
| 27 |
</p><p lang="en"> |
| 28 |
The parameter |
| 29 |
<a class="link" href="ch11s03.html#gel-function-LinePlotDrawLegends"><code class="function">LinePlotDrawLegends</code></a> |
| 30 |
controls the drawing of the legend. |
| 31 |
</p><p lang="en"> |
| 32 |
Examples: |
| 33 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>LinePlot(sin,cos)</code></strong> |
| 34 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlot(`(x)=x^2,-1,1,0,1)</code></strong> |
| 35 |
</pre><p lang="en"> |
| 36 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotClear"></a>LinePlotClear</span></dt><dd><pre lang="en" class="synopsis">LinePlotClear ()</pre><p lang="en"> |
| 37 |
Show the line plot window and clear out functions and any other |
| 38 |
lines that were drawn. |
| 39 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotCParametric"></a>LinePlotCParametric</span></dt><dd><pre lang="en" class="synopsis">LinePlotCParametric (func,...)</pre><pre lang="en" class="synopsis">LinePlotCParametric (func,t1,t2,tinc)</pre><pre lang="en" class="synopsis">LinePlotCParametric (func,t1,t2,tinc,x1,x2,y1,y2)</pre><p lang="en"> |
| 40 |
Plot a parametric complex valued function with a line. First comes |
| 41 |
the function that returns <code class="computeroutput">x+iy</code>, |
| 42 |
then optionally the <code class="varname">t</code> limits as <strong class="userinput"><code>t1,t2,tinc</code></strong>, then |
| 43 |
optionally the limits as <strong class="userinput"><code>x1,x2,y1,y2</code></strong>. |
| 44 |
</p><p lang="en"> |
| 45 |
If limits are not |
| 46 |
specified, then the currently set limits apply |
| 47 |
(See <a class="link" href="ch11s03.html#gel-function-LinePlotWindow"><code class="function">LinePlotWindow</code></a>). |
| 48 |
If instead the string "fit" is given for the x and y limits, then the limits are the maximum extent of |
| 49 |
the graph |
| 50 |
</p><p lang="en"> |
| 51 |
The parameter |
| 52 |
<a class="link" href="ch11s03.html#gel-function-LinePlotDrawLegends"><code class="function">LinePlotDrawLegends</code></a> |
| 53 |
controls the drawing of the legend. |
| 54 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotDrawLine"></a>LinePlotDrawLine</span></dt><dd><pre lang="en" class="synopsis">LinePlotDrawLine (x1,y1,x2,y2,...)</pre><pre lang="en" class="synopsis">LinePlotDrawLine (v,...)</pre><p lang="en"> |
| 55 |
Draw a line from <code class="varname">x1</code>,<code class="varname">y1</code> to |
| 56 |
<code class="varname">x2</code>,<code class="varname">y2</code>. |
| 57 |
<code class="varname">x1</code>,<code class="varname">y1</code>, |
| 58 |
<code class="varname">x2</code>,<code class="varname">y2</code> can be replaced by an |
| 59 |
<code class="varname">n</code> by 2 matrix for a longer polyline. |
| 60 |
Alternatively the vector <code class="varname">v</code> may be a column vector of complex numbers, |
| 61 |
that is an <code class="varname">n</code> by 1 matrix and each complex number is then |
| 62 |
considered a point in the plane. |
| 63 |
</p><p lang="en"> |
| 64 |
Extra parameters can be added to specify line color, thickness, |
| 65 |
arrows, the plotting window, or legend. |
| 66 |
You can do this by adding an argument string <strong class="userinput"><code>"color"</code></strong>, |
| 67 |
<strong class="userinput"><code>"thickness"</code></strong>, |
| 68 |
<strong class="userinput"><code>"window"</code></strong>, |
| 69 |
<strong class="userinput"><code>"arrow"</code></strong>, or <strong class="userinput"><code>"legend"</code></strong>, and after it specify |
| 70 |
the color, the thickness, the window |
| 71 |
as 4-vector, type of arrow, or the legend. (Arrow and window are from version 1.0.6 onwards.) |
| 72 |
</p><p lang="en"> |
| 73 |
If the line is to be treated as a filled polygon, filled with the given color, you |
| 74 |
can specify the argument <strong class="userinput"><code>"filled"</code></strong>. Since version 1.0.22 onwards. |
| 75 |
</p><p lang="en"> |
| 76 |
The color should be either a string indicating the common English word for the color |
| 77 |
that GTK will recognize such as |
| 78 |
<strong class="userinput"><code>"red"</code></strong>, <strong class="userinput"><code>"blue"</code></strong>, <strong class="userinput"><code>"yellow"</code></strong>, etc... |
| 79 |
Alternatively the color can be specified in RGB format as |
| 80 |
<strong class="userinput"><code>"#rgb"</code></strong>, <strong class="userinput"><code>"#rrggbb"</code></strong>, or |
| 81 |
<strong class="userinput"><code>"#rrrrggggbbbb"</code></strong>, where the r, g, or b are hex digits of the red, green, and blue |
| 82 |
components of the color. Finally, since version 1.0.18, the color |
| 83 |
can also be specified as a real vector specifying the red green and |
| 84 |
blue components where the components are between 0 and 1, e.g. <strong class="userinput"><code>[1.0,0.5,0.1]</code></strong>. |
| 85 |
</p><p lang="en"> |
| 86 |
The window should be given as usual as <strong class="userinput"><code>[x1,x2,y1,y2]</code></strong>, or |
| 87 |
alternatively can be given as a string |
| 88 |
<strong class="userinput"><code>"fit"</code></strong> in which case, |
| 89 |
the x range will be set precisely and the y range will be set with |
| 90 |
five percent borders around the line. |
| 91 |
</p><p lang="en"> |
| 92 |
Arrow specification should be |
| 93 |
<strong class="userinput"><code>"origin"</code></strong>, |
| 94 |
<strong class="userinput"><code>"end"</code></strong>, |
| 95 |
<strong class="userinput"><code>"both"</code></strong>, or |
| 96 |
<strong class="userinput"><code>"none"</code></strong>. |
| 97 |
</p><p lang="en"> |
| 98 |
Finally, legend should be a string that can be used as the legend in the |
| 99 |
graph. That is, if legends are being printed. |
| 100 |
</p><p lang="en"> |
| 101 |
Examples: |
| 102 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawLine(0,0,1,1,"color","blue","thickness",3)</code></strong> |
| 103 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawLine([0,0;1,-1;-1,-1])</code></strong> |
| 104 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawLine([0,0;1,1],"arrow","end")</code></strong> |
| 105 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawLine(RungeKuttaFull(`(x,y)=y,0,0.001,10,100),"color","blue","legend","The Solution")</code></strong> |
| 106 |
<code class="prompt">genius></code> <strong class="userinput"><code>for r=0.0 to 1.0 by 0.1 do LinePlotDrawLine([0,0;1,r],"color",[r,(1-r),0.5],"window",[0,1,0,1])</code></strong> |
| 107 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawLine([0,0;10,0;10,10;0,10],"filled","color","green")</code></strong> |
| 108 |
</pre><p lang="en"> |
| 109 |
</p><p lang="en"> |
| 110 |
Unlike many other functions that do not care if they take a |
| 111 |
column or a row vector, if specifying points as a vector of |
| 112 |
complex values, due to possible ambiguities, it must always |
| 113 |
be given as a column vector. |
| 114 |
</p><p lang="en"> |
| 115 |
Specifying <code class="varname">v</code> as a column vector of complex numbers is |
| 116 |
implemented from version 1.0.22 and onwards. |
| 117 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotDrawPoints"></a>LinePlotDrawPoints</span></dt><dd><pre lang="en" class="synopsis">LinePlotDrawPoints (x,y,...)</pre><pre lang="en" class="synopsis">LinePlotDrawPoints (v,...)</pre><p lang="en"> |
| 118 |
Draw a point at <code class="varname">x</code>,<code class="varname">y</code>. |
| 119 |
The input can be an <code class="varname">n</code> by 2 matrix |
| 120 |
for <code class="varname">n</code> different points. This function has essentially the same |
| 121 |
input as <a class="link" href="ch11s20.html#gel-function-LinePlotDrawLine">LinePlotDrawLine</a>. |
| 122 |
Alternatively the vector <code class="varname">v</code> may be a column vector of complex numbers, |
| 123 |
that is an <code class="varname">n</code> by 1 matrix and each complex number is then |
| 124 |
considered a point in the plane. |
| 125 |
</p><p lang="en"> |
| 126 |
Extra parameters can be added to specify color, thickness, |
| 127 |
the plotting window, or legend. |
| 128 |
You can do this by adding an argument string <strong class="userinput"><code>"color"</code></strong>, |
| 129 |
<strong class="userinput"><code>"thickness"</code></strong>, |
| 130 |
<strong class="userinput"><code>"window"</code></strong>, |
| 131 |
or <strong class="userinput"><code>"legend"</code></strong>, and after it specify |
| 132 |
the color, the thickness, the window |
| 133 |
as 4-vector, or the legend. |
| 134 |
</p><p lang="en"> |
| 135 |
The color should be either a string indicating the common English word for the color |
| 136 |
that GTK will recognize such as |
| 137 |
<strong class="userinput"><code>"red"</code></strong>, <strong class="userinput"><code>"blue"</code></strong>, <strong class="userinput"><code>"yellow"</code></strong>, etc... |
| 138 |
Alternatively the color can be specified in RGB format as |
| 139 |
<strong class="userinput"><code>"#rgb"</code></strong>, <strong class="userinput"><code>"#rrggbb"</code></strong>, or |
| 140 |
<strong class="userinput"><code>"#rrrrggggbbbb"</code></strong>, where the r, g, or b are hex digits of the red, green, and blue |
| 141 |
components of the color. Finally the color can also be specified as a real vector specifying the red green |
| 142 |
and blue components where the components are between 0 and 1. |
| 143 |
</p><p lang="en"> |
| 144 |
The window should be given as usual as <strong class="userinput"><code>[x1,x2,y1,y2]</code></strong>, or |
| 145 |
alternatively can be given as a string |
| 146 |
<strong class="userinput"><code>"fit"</code></strong> in which case, |
| 147 |
the x range will be set precisely and the y range will be set with |
| 148 |
five percent borders around the line. |
| 149 |
</p><p lang="en"> |
| 150 |
Finally, legend should be a string that can be used as the legend in the |
| 151 |
graph. That is, if legends are being printed. |
| 152 |
</p><p lang="en"> |
| 153 |
Examples: |
| 154 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawPoints(0,0,"color","blue","thickness",3)</code></strong> |
| 155 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawPoints([0,0;1,-1;-1,-1])</code></strong> |
| 156 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawPoints(RungeKuttaFull(`(x,y)=y,0,0.001,10,100),"color","blue","legend","The Solution")</code></strong> |
| 157 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawPoints([1;1+1i;1i;0],"thickness",5)</code></strong> |
| 158 |
<code class="prompt">genius></code> <strong class="userinput"><code>LinePlotDrawPoints(ApplyOverMatrix((0:6)',`(k)=exp(k*2*pi*1i/7)),"thickness",3,"legend","The 7th roots of unity")</code></strong> |
| 159 |
</pre><p lang="en"> |
| 160 |
</p><p lang="en"> |
| 161 |
Unlike many other functions that do not care if they take a |
| 162 |
column or a row vector, if specifying points as a vector of |
| 163 |
complex values, due to possible ambiguities, it must always |
| 164 |
be given as a column vector. Therefore, notice in the |
| 165 |
last example the transpose of the vector <strong class="userinput"><code>0:6</code></strong> |
| 166 |
to make it into a column vector. |
| 167 |
</p><p lang="en"> |
| 168 |
Available from version 1.0.18 onwards. Specifying |
| 169 |
<code class="varname">v</code> as a column vector of complex numbers is |
| 170 |
implemented from version 1.0.22 and onwards. |
| 171 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotMouseLocation"></a>LinePlotMouseLocation</span></dt><dd><pre lang="en" class="synopsis">LinePlotMouseLocation ()</pre><p lang="en"> |
| 172 |
Returns a row vector of a point on the line plot corresponding to |
| 173 |
the current mouse location. If the line plot is not visible, |
| 174 |
then prints an error and returns <code class="constant">null</code>. |
| 175 |
In this case you should run |
| 176 |
<a class="link" href="ch11s20.html#gel-function-LinePlot"><code class="function">LinePlot</code></a> or |
| 177 |
<a class="link" href="ch11s20.html#gel-function-LinePlotClear"><code class="function">LinePlotClear</code></a> |
| 178 |
to put the graphing window into the line plot mode. |
| 179 |
See also |
| 180 |
<a class="link" href="ch11s20.html#gel-function-LinePlotWaitForClick"><code class="function">LinePlotWaitForClick</code></a>. |
| 181 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotParametric"></a>LinePlotParametric</span></dt><dd><pre lang="en" class="synopsis">LinePlotParametric (xfunc,yfunc,...)</pre><pre lang="en" class="synopsis">LinePlotParametric (xfunc,yfunc,t1,t2,tinc)</pre><pre lang="en" class="synopsis">LinePlotParametric (xfunc,yfunc,t1,t2,tinc,x1,x2,y1,y2)</pre><pre lang="en" class="synopsis">LinePlotParametric (xfunc,yfunc,t1,t2,tinc,[x1,x2,y1,y2])</pre><pre lang="en" class="synopsis">LinePlotParametric (xfunc,yfunc,t1,t2,tinc,"fit")</pre><p lang="en"> |
| 182 |
Plot a parametric function with a line. First come the functions |
| 183 |
for <code class="varname">x</code> and <code class="varname">y</code> then optionally the <code class="varname">t</code> limits as <strong class="userinput"><code>t1,t2,tinc</code></strong>, then optionally the |
| 184 |
limits as <strong class="userinput"><code>x1,x2,y1,y2</code></strong>. |
| 185 |
</p><p lang="en"> |
| 186 |
If x and y limits are not |
| 187 |
specified, then the currently set limits apply |
| 188 |
(See <a class="link" href="ch11s03.html#gel-function-LinePlotWindow"><code class="function">LinePlotWindow</code></a>). |
| 189 |
If instead the string "fit" is given for the x and y limits, then the limits are the maximum extent of |
| 190 |
the graph |
| 191 |
</p><p lang="en"> |
| 192 |
The parameter |
| 193 |
<a class="link" href="ch11s03.html#gel-function-LinePlotDrawLegends"><code class="function">LinePlotDrawLegends</code></a> |
| 194 |
controls the drawing of the legend. |
| 195 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-LinePlotWaitForClick"></a>LinePlotWaitForClick</span></dt><dd><pre lang="en" class="synopsis">LinePlotWaitForClick ()</pre><p lang="en"> |
| 196 |
If in line plot mode, waits for a click on the line plot window |
| 197 |
and returns the location of the click as a row vector. |
| 198 |
If the window is closed |
| 199 |
the function returns immediately with <code class="constant">null</code>. |
| 200 |
If the window is not in line plot mode, it is put in it and shown |
| 201 |
if not shown. |
| 202 |
See also |
| 203 |
<a class="link" href="ch11s20.html#gel-function-LinePlotMouseLocation"><code class="function">LinePlotMouseLocation</code></a>. |
| 204 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-PlotCanvasFreeze"></a>PlotCanvasFreeze</span></dt><dd><pre lang="en" class="synopsis">PlotCanvasFreeze ()</pre><p lang="en"> |
| 205 |
Freeze drawing of the canvas plot temporarily. Useful if you need to draw a bunch of elements |
| 206 |
and want to delay drawing everything to avoid flicker in an animation. After everything |
| 207 |
has been drawn you should call <a class="link" href="ch11s20.html#gel-function-PlotCanvasThaw"><code class="function">PlotCanvasThaw</code></a>. |
| 208 |
</p><p lang="en"> |
| 209 |
The canvas is always thawed after end of any execution, so it will never remain frozen. The moment |
| 210 |
a new command line is shown for example the plot canvas is thawed automatically. Also note that |
| 211 |
calls to freeze and thaw may be safely nested. |
| 212 |
</p><p lang="en">Version 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-PlotCanvasThaw"></a>PlotCanvasThaw</span></dt><dd><pre lang="en" class="synopsis">PlotCanvasThaw ()</pre><p lang="en"> |
| 213 |
Thaw the plot canvas frozen by |
| 214 |
<a class="link" href="ch11s20.html#gel-function-PlotCanvasFreeze"><code class="function">PlotCanvasFreeze</code></a> |
| 215 |
and redraw the canvas immediately. The canvas is also always thawed after end of execution |
| 216 |
of any program. |
| 217 |
</p><p lang="en">Version 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-PlotWindowPresent"></a>PlotWindowPresent</span></dt><dd><pre lang="en" class="synopsis">PlotWindowPresent ()</pre><p lang="en"> |
| 218 |
Show and raise the plot window, creating it if necessary. |
| 219 |
Normally the window is created when one of the plotting |
| 220 |
functions is called, but it is not always raised if it |
| 221 |
happens to be below other windows. So this function is |
| 222 |
good to call in scripts where the plot window might have |
| 223 |
been created before, and by now is hidden behind the |
| 224 |
console or other windows. |
| 225 |
</p><p lang="en">Version 1.0.19 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SlopefieldClearSolutions"></a>SlopefieldClearSolutions</span></dt><dd><pre lang="en" class="synopsis">SlopefieldClearSolutions ()</pre><p lang="en"> |
| 226 |
Clears the solutions drawn by the |
| 227 |
<a class="link" href="ch11s20.html#gel-function-SlopefieldDrawSolution"><code class="function">SlopefieldDrawSolution</code></a> |
| 228 |
function. |
| 229 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SlopefieldDrawSolution"></a>SlopefieldDrawSolution</span></dt><dd><pre lang="en" class="synopsis">SlopefieldDrawSolution (x, y, dx)</pre><p lang="en"> |
| 230 |
When a slope field plot is active, draw a solution with |
| 231 |
the specified initial condition. The standard |
| 232 |
Runge-Kutta method is used with increment <code class="varname">dx</code>. |
| 233 |
Solutions stay on the graph until a different plot is shown or until |
| 234 |
you call |
| 235 |
<a class="link" href="ch11s20.html#gel-function-SlopefieldClearSolutions"><code class="function">SlopefieldClearSolutions</code></a>. |
| 236 |
You can also use the graphical interface to draw solutions and specify |
| 237 |
initial conditions with the mouse. |
| 238 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SlopefieldPlot"></a>SlopefieldPlot</span></dt><dd><pre lang="en" class="synopsis">SlopefieldPlot (func)</pre><pre lang="en" class="synopsis">SlopefieldPlot (func,x1,x2,y1,y2)</pre><p lang="en"> |
| 239 |
Plot a slope field. The function <code class="varname">func</code> |
| 240 |
should take two real numbers <code class="varname">x</code> |
| 241 |
and <code class="varname">y</code>, or a single complex |
| 242 |
number. |
| 243 |
Optionally you can specify the limits of the plotting window as |
| 244 |
<code class="varname">x1</code>, <code class="varname">x2</code>, |
| 245 |
<code class="varname">y1</code>, <code class="varname">y2</code>. If limits are not |
| 246 |
specified, then the currently set limits apply |
| 247 |
(See <a class="link" href="ch11s03.html#gel-function-LinePlotWindow"><code class="function">LinePlotWindow</code></a>). |
| 248 |
</p><p lang="en"> |
| 249 |
The parameter |
| 250 |
<a class="link" href="ch11s03.html#gel-function-LinePlotDrawLegends"><code class="function">LinePlotDrawLegends</code></a> |
| 251 |
controls the drawing of the legend. |
| 252 |
</p><p lang="en"> |
| 253 |
Examples: |
| 254 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SlopefieldPlot(`(x,y)=sin(x-y),-5,5,-5,5)</code></strong> |
| 255 |
</pre><p lang="en"> |
| 256 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlot"></a>SurfacePlot</span></dt><dd><pre lang="en" class="synopsis">SurfacePlot (func)</pre><pre lang="en" class="synopsis">SurfacePlot (func,x1,x2,y1,y2,z1,z2)</pre><pre lang="en" class="synopsis">SurfacePlot (func,x1,x2,y1,y2)</pre><pre lang="en" class="synopsis">SurfacePlot (func,[x1,x2,y1,y2,z1,z2])</pre><pre lang="en" class="synopsis">SurfacePlot (func,[x1,x2,y1,y2])</pre><p lang="en"> |
| 257 |
Plot a surface function that takes either two arguments or a complex number. First comes the function then optionally limits as <code class="varname">x1</code>, <code class="varname">x2</code>, |
| 258 |
<code class="varname">y1</code>, <code class="varname">y2</code>, |
| 259 |
<code class="varname">z1</code>, <code class="varname">z2</code>. If limits are not |
| 260 |
specified, then the currently set limits apply |
| 261 |
(See <a class="link" href="ch11s03.html#gel-function-SurfacePlotWindow"><code class="function">SurfacePlotWindow</code></a>). |
| 262 |
Genius can only plot a single surface function at this time. |
| 263 |
</p><p lang="en"> |
| 264 |
If the z limits are not specified then the maxima and minima of the function are used. |
| 265 |
</p><p lang="en"> |
| 266 |
Examples: |
| 267 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlot(|sin|,-1,1,-1,1,0,1.5)</code></strong> |
| 268 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlot(`(x,y)=x^2+y,-1,1,-1,1,-2,2)</code></strong> |
| 269 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlot(`(z)=|z|^2,-1,1,-1,1,0,2)</code></strong> |
| 270 |
</pre><p lang="en"> |
| 271 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlotClear"></a>SurfacePlotClear</span></dt><dd><pre lang="en" class="synopsis">SurfacePlotClear ()</pre><p lang="en"> |
| 272 |
Show the surface plot window and clear out functions and any other |
| 273 |
lines that were drawn. |
| 274 |
</p><p lang="en"> |
| 275 |
Available in version 1.0.19 and onwards. |
| 276 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlotData"></a>SurfacePlotData</span></dt><dd><pre lang="en" class="synopsis">SurfacePlotData (data)</pre><pre lang="en" class="synopsis">SurfacePlotData (data,label)</pre><pre lang="en" class="synopsis">SurfacePlotData (data,x1,x2,y1,y2,z1,z2)</pre><pre lang="en" class="synopsis">SurfacePlotData (data,label,x1,x2,y1,y2,z1,z2)</pre><pre lang="en" class="synopsis">SurfacePlotData (data,[x1,x2,y1,y2,z1,z2])</pre><pre lang="en" class="synopsis">SurfacePlotData (data,label,[x1,x2,y1,y2,z1,z2])</pre><p lang="en"> |
| 277 |
Plot a surface from data. The data is an n by 3 matrix whose |
| 278 |
rows are the x, y and z coordinates. The data can also be |
| 279 |
simply a vector whose length is a multiple of 3 and so |
| 280 |
contains the triples of x, y, z. The data should contain at |
| 281 |
least 3 points. |
| 282 |
</p><p lang="en"> |
| 283 |
Optionally we can give the label and also optionally the |
| 284 |
limits. If limits are not given, they are computed from |
| 285 |
the data, <a class="link" href="ch11s03.html#gel-function-SurfacePlotWindow"><code class="function">SurfacePlotWindow</code></a> |
| 286 |
is not used, if you want to use it, pass it in explicitly. |
| 287 |
If label is not given then empty label is used. |
| 288 |
</p><p lang="en"> |
| 289 |
Examples: |
| 290 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotData([0,0,0;1,0,1;0,1,1;1,1,3])</code></strong> |
| 291 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotData(data,"My data")</code></strong> |
| 292 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotData(data,-1,1,-1,1,0,10)</code></strong> |
| 293 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotData(data,SurfacePlotWindow)</code></strong> |
| 294 |
</pre><p lang="en"> |
| 295 |
</p><p lang="en"> |
| 296 |
Here's an example of how to plot in polar coordinates, |
| 297 |
in particular how to plot the function |
| 298 |
<strong class="userinput"><code>-r^2 * theta</code></strong>: |
| 299 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>d:=null; for r=0 to 1 by 0.1 do for theta=0 to 2*pi by pi/5 do d=[d;[r*cos(theta),r*sin(theta),-r^2*theta]];</code></strong> |
| 300 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotData(d)</code></strong> |
| 301 |
</pre><p lang="en"> |
| 302 |
</p><p lang="en">Version 1.0.16 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlotDataGrid"></a>SurfacePlotDataGrid</span></dt><dd><pre lang="en" class="synopsis">SurfacePlotDataGrid (data,[x1,x2,y1,y2])</pre><pre lang="en" class="synopsis">SurfacePlotDataGrid (data,[x1,x2,y1,y2,z1,z2])</pre><pre lang="en" class="synopsis">SurfacePlotDataGrid (data,[x1,x2,y1,y2],label)</pre><pre lang="en" class="synopsis">SurfacePlotDataGrid (data,[x1,x2,y1,y2,z1,z2],label)</pre><p lang="en"> |
| 303 |
Plot a surface from regular rectangular data. |
| 304 |
The data is given in a n by m matrix where the rows are the |
| 305 |
x coordinate and the columns are the y coordinate. |
| 306 |
The x coordinate is divided into equal n-1 subintervals |
| 307 |
and y coordinate is divided into equal m-1 subintervals. |
| 308 |
The limits <code class="varname">x1</code> and <code class="varname">x2</code> |
| 309 |
give the interval on the x-axis that we use, and |
| 310 |
the limits <code class="varname">y1</code> and <code class="varname">y2</code> |
| 311 |
give the interval on the y-axis that we use. |
| 312 |
If the limits <code class="varname">z1</code> and <code class="varname">z2</code> |
| 313 |
are not given they are computed from the data (to be |
| 314 |
the extreme values from the data). |
| 315 |
</p><p lang="en"> |
| 316 |
Optionally we can give the label, if label is not given then |
| 317 |
empty label is used. |
| 318 |
</p><p lang="en"> |
| 319 |
Examples: |
| 320 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDataGrid([1,2;3,4],[0,1,0,1])</code></strong> |
| 321 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDataGrid(data,[-1,1,-1,1],"My data")</code></strong> |
| 322 |
<code class="prompt">genius></code> <strong class="userinput"><code>d:=null; for i=1 to 20 do for j=1 to 10 do d@(i,j) = (0.1*i-1)^2-(0.1*j)^2;</code></strong> |
| 323 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDataGrid(d,[-1,1,0,1],"half a saddle")</code></strong> |
| 324 |
</pre><p lang="en"> |
| 325 |
</p><p lang="en">Version 1.0.16 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlotDrawLine"></a>SurfacePlotDrawLine</span></dt><dd><pre lang="en" class="synopsis">SurfacePlotDrawLine (x1,y1,z1,x2,y2,z2,...)</pre><pre lang="en" class="synopsis">SurfacePlotDrawLine (v,...)</pre><p lang="en"> |
| 326 |
Draw a line from <code class="varname">x1</code>,<code class="varname">y1</code>,<code class="varname">z1</code> to |
| 327 |
<code class="varname">x2</code>,<code class="varname">y2</code>,<code class="varname">z2</code>. |
| 328 |
<code class="varname">x1</code>,<code class="varname">y1</code>,<code class="varname">z1</code>, |
| 329 |
<code class="varname">x2</code>,<code class="varname">y2</code>,<code class="varname">z2</code> can be replaced by an |
| 330 |
<code class="varname">n</code> by 3 matrix for a longer polyline. |
| 331 |
</p><p lang="en"> |
| 332 |
Extra parameters can be added to specify line color, thickness, |
| 333 |
the plotting window, or legend. |
| 334 |
You can do this by adding an argument string <strong class="userinput"><code>"color"</code></strong>, |
| 335 |
<strong class="userinput"><code>"thickness"</code></strong>, |
| 336 |
<strong class="userinput"><code>"window"</code></strong>, |
| 337 |
or <strong class="userinput"><code>"legend"</code></strong>, and after it specify |
| 338 |
the color, the thickness, the window |
| 339 |
as 6-vector, or the legend. |
| 340 |
</p><p lang="en"> |
| 341 |
The color should be either a string indicating the common English word for the color |
| 342 |
that GTK will recognize such as |
| 343 |
<strong class="userinput"><code>"red"</code></strong>, <strong class="userinput"><code>"blue"</code></strong>, <strong class="userinput"><code>"yellow"</code></strong>, etc... |
| 344 |
Alternatively the color can be specified in RGB format as |
| 345 |
<strong class="userinput"><code>"#rgb"</code></strong>, <strong class="userinput"><code>"#rrggbb"</code></strong>, or |
| 346 |
<strong class="userinput"><code>"#rrrrggggbbbb"</code></strong>, where the r, g, or b are hex digits of the red, green, and blue |
| 347 |
components of the color. Finally, since version 1.0.18, the color |
| 348 |
can also be specified as a real vector specifying the red green and |
| 349 |
blue components where the components are between 0 and 1, e.g. <strong class="userinput"><code>[1.0,0.5,0.1]</code></strong>. |
| 350 |
</p><p lang="en"> |
| 351 |
The window should be given as usual as <strong class="userinput"><code>[x1,x2,y1,y2,z1,z2]</code></strong>, or |
| 352 |
alternatively can be given as a string |
| 353 |
<strong class="userinput"><code>"fit"</code></strong> in which case, |
| 354 |
the x range will be set precisely and the y range will be set with |
| 355 |
five percent borders around the line. |
| 356 |
</p><p lang="en"> |
| 357 |
Finally, legend should be a string that can be used as the legend in the |
| 358 |
graph. That is, if legends are being printed. |
| 359 |
</p><p lang="en"> |
| 360 |
Examples: |
| 361 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDrawLine(0,0,0,1,1,1,"color","blue","thickness",3)</code></strong> |
| 362 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDrawLine([0,0,0;1,-1,2;-1,-1,-3])</code></strong> |
| 363 |
</pre><p lang="en"> |
| 364 |
</p><p lang="en"> |
| 365 |
Available from version 1.0.19 onwards. |
| 366 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SurfacePlotDrawPoints"></a>SurfacePlotDrawPoints</span></dt><dd><pre lang="en" class="synopsis">SurfacePlotDrawPoints (x,y,z,...)</pre><pre lang="en" class="synopsis">SurfacePlotDrawPoints (v,...)</pre><p lang="en"> |
| 367 |
Draw a point at <code class="varname">x</code>,<code class="varname">y</code>,<code class="varname">z</code>. |
| 368 |
The input can be an <code class="varname">n</code> by 3 matrix |
| 369 |
for <code class="varname">n</code> different points. This function has essentially the same |
| 370 |
input as <a class="link" href="ch11s20.html#gel-function-SurfacePlotDrawLine">SurfacePlotDrawLine</a>. |
| 371 |
</p><p lang="en"> |
| 372 |
Extra parameters can be added to specify line color, thickness, |
| 373 |
the plotting window, or legend. |
| 374 |
You can do this by adding an argument string <strong class="userinput"><code>"color"</code></strong>, |
| 375 |
<strong class="userinput"><code>"thickness"</code></strong>, |
| 376 |
<strong class="userinput"><code>"window"</code></strong>, |
| 377 |
or <strong class="userinput"><code>"legend"</code></strong>, and after it specify |
| 378 |
the color, the thickness, the window |
| 379 |
as 6-vector, or the legend. |
| 380 |
</p><p lang="en"> |
| 381 |
The color should be either a string indicating the common English word for the color |
| 382 |
that GTK will recognize such as |
| 383 |
<strong class="userinput"><code>"red"</code></strong>, <strong class="userinput"><code>"blue"</code></strong>, <strong class="userinput"><code>"yellow"</code></strong>, etc... |
| 384 |
Alternatively the color can be specified in RGB format as |
| 385 |
<strong class="userinput"><code>"#rgb"</code></strong>, <strong class="userinput"><code>"#rrggbb"</code></strong>, or |
| 386 |
<strong class="userinput"><code>"#rrrrggggbbbb"</code></strong>, where the r, g, or b are hex digits of the red, green, and blue |
| 387 |
components of the color. Finally the color can also be specified as a real vector specifying the red green |
| 388 |
and blue components where the components are between 0 and 1. |
| 389 |
</p><p lang="en"> |
| 390 |
The window should be given as usual as <strong class="userinput"><code>[x1,x2,y1,y2,z1,z2]</code></strong>, or |
| 391 |
alternatively can be given as a string |
| 392 |
<strong class="userinput"><code>"fit"</code></strong> in which case, |
| 393 |
the x range will be set precisely and the y range will be set with |
| 394 |
five percent borders around the line. |
| 395 |
</p><p lang="en"> |
| 396 |
Finally, legend should be a string that can be used as the legend in the |
| 397 |
graph. That is, if legends are being printed. |
| 398 |
</p><p lang="en"> |
| 399 |
Examples: |
| 400 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDrawPoints(0,0,0,"color","blue","thickness",3)</code></strong> |
| 401 |
<code class="prompt">genius></code> <strong class="userinput"><code>SurfacePlotDrawPoints([0,0,0;1,-1,2;-1,-1,1])</code></strong> |
| 402 |
</pre><p lang="en"> |
| 403 |
</p><p lang="en"> |
| 404 |
Available from version 1.0.19 onwards. |
| 405 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-VectorfieldClearSolutions"></a>VectorfieldClearSolutions</span></dt><dd><pre lang="en" class="synopsis">VectorfieldClearSolutions ()</pre><p lang="en"> |
| 406 |
Clears the solutions drawn by the |
| 407 |
<a class="link" href="ch11s20.html#gel-function-VectorfieldDrawSolution"><code class="function">VectorfieldDrawSolution</code></a> |
| 408 |
function. |
| 409 |
</p><p lang="en">Version 1.0.6 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-VectorfieldDrawSolution"></a>VectorfieldDrawSolution</span></dt><dd><pre lang="en" class="synopsis">VectorfieldDrawSolution (x, y, dt, tlen)</pre><p lang="en"> |
| 410 |
When a vector field plot is active, draw a solution with |
| 411 |
the specified initial condition. The standard |
| 412 |
Runge-Kutta method is used with increment <code class="varname">dt</code> |
| 413 |
for an interval of length <code class="varname">tlen</code>. |
| 414 |
Solutions stay on the graph until a different plot is shown or until |
| 415 |
you call |
| 416 |
<a class="link" href="ch11s20.html#gel-function-VectorfieldClearSolutions"><code class="function">VectorfieldClearSolutions</code></a>. |
| 417 |
You can also use the graphical interface to draw solutions and specify |
| 418 |
initial conditions with the mouse. |
| 419 |
</p><p lang="en">Version 1.0.6 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-VectorfieldPlot"></a>VectorfieldPlot</span></dt><dd><pre lang="en" class="synopsis">VectorfieldPlot (funcx, funcy)</pre><pre lang="en" class="synopsis">VectorfieldPlot (funcx, funcy, x1, x2, y1, y2)</pre><p lang="en"> |
| 420 |
Plot a two dimensional vector field. The function |
| 421 |
<code class="varname">funcx</code> |
| 422 |
should be the dx/dt of the vectorfield and the function |
| 423 |
<code class="varname">funcy</code> should be the dy/dt of the vectorfield. |
| 424 |
The functions |
| 425 |
should take two real numbers <code class="varname">x</code> |
| 426 |
and <code class="varname">y</code>, or a single complex |
| 427 |
number. When the parameter |
| 428 |
<a class="link" href="ch11s03.html#gel-function-VectorfieldNormalized"><code class="function">VectorfieldNormalized</code></a> |
| 429 |
is <code class="constant">true</code>, then the magnitude of the vectors is normalized. That is, only |
| 430 |
the direction and not the magnitude is shown. |
| 431 |
</p><p lang="en"> |
| 432 |
Optionally you can specify the limits of the plotting window as |
| 433 |
<code class="varname">x1</code>, <code class="varname">x2</code>, |
| 434 |
<code class="varname">y1</code>, <code class="varname">y2</code>. If limits are not |
| 435 |
specified, then the currently set limits apply |
| 436 |
(See <a class="link" href="ch11s03.html#gel-function-LinePlotWindow"><code class="function">LinePlotWindow</code></a>). |
| 437 |
</p><p lang="en"> |
| 438 |
The parameter |
| 439 |
<a class="link" href="ch11s03.html#gel-function-LinePlotDrawLegends"><code class="function">LinePlotDrawLegends</code></a> |
| 440 |
controls the drawing of the legend. |
| 441 |
</p><p lang="en"> |
| 442 |
Examples: |
| 443 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>VectorfieldPlot(`(x,y)=x^2-y, `(x,y)=y^2-x, -1, 1, -1, 1)</code></strong> |
| 444 |
</pre><p lang="en"> |
| 445 |
</p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s19.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Operações simbólicas </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 12. Example Programs in GEL</td></tr></table></div></body></html> |