Drawing area

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


plot::Canvas(object1, object2, …, <a = amin .. amax>, options)


plot::Canvas is the top level element of the hierachy of graphical objects. It represents the 2 dimensional drawing area into which 2D and 3D plots are painted.

The user does not need to create a canvas object explicitly, because a plot command such as plot(object1, object2, …) implicitly creates a default canvas object to display the graphical objects in.

Strictly speaking, a canvas object is a container for scenes of type plot::Scene2d or plot::Scene3d, respectively. The user, however, does not have to bother about this technicality, because a suitable default scene is created internally, when graphical primitives are passed to plot::Canvas.

A canvas can display several scenes simultaneously. However, all scenes must be of the same dimension. A mixture of 2D and 3D is not supported!

See the help page of the canvas attribute Layout for details on the layout of a canvas containing several scenes.

The canvas object is always visible in the interactive object browser of the MuPAD® graphics tool (see section Viewer, Browser, and Inspector: Interactive Manipulation of this document). It can contain one or more scenes as its children. When the canvas object is selected, it provides access to a variety of attributes that are associated with the canves. The canvas attributes allow to

A complete listing of the attributes associated with a canvas is given below. Follow the links to the help pages of the attributes to find more detailed information.

Apart from these attributes of the canvas object, also attributes for scenes, coordinate systems and graphical objects inside the canvas can be specified when generating a canvas object. These attribute values are inherited to the objects inside the canvas as new default values.


AttributePurposeDefault Value
AnimationStylebehaviour of the animation toolbarRunOnce
AutoPlaystart animations automaticallyTRUE
BackgroundColorbackground colorRGB::White
BorderColorcolor of frame/border around canvas and scenesRGB::Grey50
BorderWidthwidth of frame/border around canvas and scenes0
BottomMarginbottom margin width1
Columnsnumber of columns of scenes0
Footerfooter text 
FooterFontfont of footers (scene and canvas)[" sans-serif ", 12]
FooterAlignmentalignment of footer of canvas and scenesCenter
Headerheader text 
HeaderFontfont of headers (scene and canvas)[" sans-serif ", 12]
HeaderAlignmentalignment of header of canvas and scenesCenter
Heightheights of canvas/scenes80
InitialTimeinitial time of the animation slider 
Layoutarrangement/layout of several scenes in a canvasTabular
LeftMarginleft margin width1
Marginmargins around canvas and scenes1
Namethe name of a plot object (for browser and legend) 
OutputUnitsthe physical length unit used by the inspectorunit::mm
RightMarginright margin width1
Rowsnumber of rows of scenes0
Spacingspace between scenes1.0
TopMargintop margin width1
Widthwidths of canvas/scenes120


Example 1

We diplay several scenes in a canvas. Various canvas attributes are passed when creating the canvas object:

S1 := plot::Scene2d(plot::Function2d(sin(x), x = 0..2*PI),
                    Header = "the sine function"):
S2 := plot::Scene2d(plot::Function2d(cos(x), x = 0..2*PI),
                    Header = "the cosine function"):
S3 := plot::Scene2d(plot::Function2d(tan(x), x = 0..PI),
                    Header = "the tan function"):
S4 := plot::Scene2d(plot::Function2d(cot(x), x = 0..PI),
                    Header = "the cot function"):
C := plot::Canvas(S1, S2, S3, S4, 
                  Width = 80*unit::mm, Height = 80*unit::mm,
                  BorderWidth = 0.5*unit::mm,
                  Header = "trigonometric functions",
                  HeaderFont = ["Times New Roman", Bold, 18]):

delete S1, S2, S3, S4, C:


object1, object2, …

Graphical objects

See Also

MuPAD Functions

MuPAD Graphical Primitives