DocumentTools[Canvas]
StaticPlot
create a canvas plot
Calling Sequence
Parameters
Description
Examples
Compatibility
StaticPlot(plot)
StaticPlot(plot, options)
plot
-
2-D plot structure
options
(optional) name=value pairs
The StaticPlot command is used to render a plot inline in a shared canvas. The plot argument is the result of a call to one of Maple's plot commands.
The onclick option can be used to specify the name of a ScriptButton in the canvas description. When a user clicks over the plot, then a global variable named _location will be set to the [x,y] coordinates of the click. See the example below.
The custom option can be used to specify a string identifier that can later be used to locate the element using scripting commands and GetElements
The scrollHorizontal truefalse option will set the default zoom mode in Maple Learn to apply only in the horizontal direction
The scrollVertical truefalse option will set the default zoom mode in Maple Learn to apply only in the vertical direction
The lockedView truefalse option, when true, will "lock" the view in Maple Learn so that subsequent curves added to the plot will not cause the view to change.
The lockedAspect truefalse option will set the aspect ration of the plot in Maple Learn to 1:1, similar to the constrained option for Maple plots.
The showSpecial truefalse option turns on the "Show special points" feature for a live plot in Maple Learn.
Note: When viewed in a canvas in Maple, in order to enable click actions, you must use the plot click and drag manipulator tool ( ). If not already selected, you can select this tool from the plotting toolbar.
with⁡DocumentTools:-Canvas:
cv≔NewCanvas⁡Plot Example,Text⁡A plot of: %1,x+12−1,StaticPlot⁡plot⁡x+12−1:
ShareCanvas⁡cv
This example implements a click-on-plot action, such that a point appears on the plot where the cursor was when the plot was clicked. Other script actions could be added as needed.
clickplot := proc( canvas ) global _location; local elems := GetElements(canvas,"plot"); local sc := Script(); SetActive(sc,elems[1]); local plt := ( if assigned(_location) then plots[pointplot](_location,view=[-1..1,-1..1]); else plots[textplot]([.5,.5,"click on plot"],view=[-1..1,-1..1]); end if); SetPlot(sc,plt); ToString(sc); end proc:
cv≔NewCanvas⁡Test Click-on-plot,StaticPlot⁡plotstextplot⁡0.5,0.5,click on plot,view=−1..1,−1..1,onclick=Reset,ScriptButton⁡Reset,clickplot:
The DocumentTools[Canvas][StaticPlot] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
The DocumentTools[Canvas][StaticPlot] command was updated in Maple 2022.
The onclick option was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
The custom, scrollHorizontal, scrollVertical, lockedView, lockedAspect and showSpecial options were introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
Annotate
GetCanvas
Math
NewCanvas
Script
ShareCanvas
Text
Download Help Document