Maplets[Elements] - Maple Programming Help

Home : Support : Online Help : Programming : Maplets : Elements : Window Body Elements : Maplets/Elements/Plotter

Maplets[Elements]

 Plotter
 define a 2-D or 3-D plot viewer

 Calling Sequence Plotter(opts) Plotter[refID](opts)

Parameters

 opts - equation(s) of the form option=value where option is one of background, continuous, delay, frame_backwards, frame_forward, height, pause, play, reference, stop, to_end, to_start, tooltip, value, visible, or width; specify options for the Plotter element refID - name or string; reference to the element

Description

 • The Plotter window body element defines a plot viewer in a Maplet application. Both 2-D and 3-D plots and animations can be displayed in a Plotter element.

 • The Plotter element features can be modified by using options. To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are, by default, assigned.

 Elements, Symbols, or Types Assumed Option or Content Maple 2-D or 3-D plot value option refID reference option string or symbol tooltip option

 • A Plotter element cannot contain other elements.
 • A Plotter element can be contained in a Maplet or BoxLayout element, or Maplet element in a nested list representing a box layout.
 • The following table describes the control and use of the Plotter element options.
 An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).
 An x in the R column indicates that the option is required in the calling sequence.
 An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.
 An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.

 Option I R G S background x x x continuous x x x delay x x x frame_backwards x frame_forward x height x x x pause x play x x reference x stop x to_end x to_start x tooltip x x x value x x visible x x x width x x x

 • The opts argument can contain one or more of the following equations that set Maplet application options.
 background = color
 The background color of the Maplet application.  This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
 height = posint
 The height of the plot viewer in pixels. By default, the height is 400 pixels.
 reference = name or string
 A reference for the Plotter element.
 If the reference is specified by both an index, for example, Plotter[refID], and a reference in the calling sequence, the index reference takes precedence.
 tooltip = symbol or string
 The text that appears in the tooltip help window.
 value = specfunc(anything, {PLOT, PLOT3D})
 A Maple plot structure.  This can be the output of plot, plot3d, or any other plotting routine, or any user-defined PLOT or PLOT3D structure.
 visible = true or false
 Whether the plot viewer is visible to the user.  By default, the value is true.
 width = posint
 The width of the plot viewer in pixels. By default, the width is 400 pixels.
 • The following equations to the opts argument control plot animations.
 continuous = true or false
 If set to true, the animation plays continuously. If set to false, the animation stops after displaying all the frames once. By default, this option is set to true.
 delay = posint
 The delay in milliseconds between frames. The default value for this option is $100$.
 frame_backwards = true
 Setting this parameter to true displays the previous frame in the sequence. If the animation is in progress it stops first.
 frame_forward = true
 Setting this parameter to true displays the next frame in the sequence. If the animation is in progress it stops first.
 pause = true
 Setting this parameter to true pauses the animation. It can be resumed by using the following play option.
 play = true
 Setting this parameter to true starts the animation (or resumes it if previously paused). By default, this option is set to false.
 stop = true
 Setting this parameter to true stops the animation. Because stop is also a keyword, you must use left single quotes (back quotes) ( ) to refer to this option.
 to_end = true
 Setting this parameter to true displays the last frame of the animation. If the animation is in progress it stops first.
 to_start = true
 Setting this parameter to true displays the first frame of the animation. If the animation is in progress it stops first.

Examples

A Maplet application that plots functions of 'x':

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet2d}≔\mathrm{Maplet}\left(\left[\left["Enter a function of \text{'}x\text{'}:",\mathrm{TextField}\left['\mathrm{TF2d}'\right]\left("sin\left(x\right)"\right)\right],\mathrm{Plotter}\left['\mathrm{PL1}'\right]\left(\mathrm{plot}\left(\mathrm{sin}\left(x\right),x=0..10\right)\right),\left[\mathrm{Button}\left("Plot",\mathrm{Evaluate}\left('\mathrm{PL1}'='\mathrm{plot}\left(\mathrm{TF2d},x=0..10\right)'\right)\right),\mathrm{Button}\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF2d}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{result}≔\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet2d}\right)$

A Maplet application that plots functions of 'x' and 'y':

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet3d}≔\mathrm{Maplet}\left(\left[\left["Enter a function of \text{'}x\text{'} and \text{'}y\text{'}:",\mathrm{TextField}\left['\mathrm{TF3d}'\right]\left(\right)\right],\mathrm{Plotter}\left['\mathrm{PL1}'\right]\left(\right),\left[\mathrm{Button}\left("Plot",\mathrm{Evaluate}\left('\mathrm{PL1}'='\mathrm{plot3d}\left(\mathrm{TF3d},x=0..10,y=0..10\right)'\right)\right),\mathrm{Button}\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF3d}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{result}≔\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet3d}\right)$

A simple Maplet application demonstrating the animation capabilities:

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right)$
 > $p≔\mathrm{plots}\left[\mathrm{animate}\right]\left(\mathrm{plot},\left[ax+2a,x=-10..10\right],a=-5..5,\mathrm{frames}=20\right):$
 > $\mathrm{animator}≔\mathrm{Maplet}\left(\left[\mathrm{Plotter}\left[P\right]\left(p,\mathrm{continuous}=\mathrm{false}\right),\left[\mathrm{Button}\left("play",\mathrm{SetOption}\left(P\left('\mathrm{play}'\right)=\mathrm{true}\right)\right),\mathrm{Button}\left("stop",\mathrm{SetOption}\left(P\left('\mathrm{stop}'\right)=\mathrm{true}\right)\right),\mathrm{Button}\left("pause",\mathrm{SetOption}\left(P\left('\mathrm{pause}'\right)=\mathrm{true}\right)\right)\right],\left[\mathrm{Button}\left("to start",\mathrm{SetOption}\left(P\left('\mathrm{to_start}'\right)=\mathrm{true}\right)\right),\mathrm{Button}\left("to end",\mathrm{SetOption}\left(P\left('\mathrm{to_end}'\right)=\mathrm{true}\right)\right)\right],\left[\mathrm{Button}\left("backwards",\mathrm{SetOption}\left(P\left('\mathrm{frame_backwards}'\right)=\mathrm{true}\right)\right),\mathrm{Button}\left("forward",\mathrm{SetOption}\left(P\left('\mathrm{frame_forward}'\right)=\mathrm{true}\right)\right)\right],\left["continuous",\mathrm{CheckBox}\left[\mathrm{CONTINUOUS}\right]\left(\mathrm{value}=\mathrm{false},\mathrm{onchange}=\mathrm{SetOption}\left(\mathrm{target}=P,\mathrm{option}='\mathrm{continuous}',\mathrm{Argument}\left(\mathrm{CONTINUOUS}\right)\right)\right)\right],\left["delay",\mathrm{Slider}\left[\mathrm{DELAY}\right]\left(100..500,200,'\mathrm{filled}'=\mathrm{true},'\mathrm{showticks}','\mathrm{majorticks}'=100,'\mathrm{minorticks}'=50,\mathrm{onchange}=\mathrm{SetOption}\left(\mathrm{target}=P,\mathrm{option}='\mathrm{delay}',\mathrm{Argument}\left(\mathrm{DELAY}\right)\right)\right)\right],\mathrm{Button}\left("ok",\mathrm{Shutdown}\left(\right)\right)\right]\right):$
 > $\mathrm{Maplets}:-\mathrm{Display}\left(\mathrm{animator}\right)$