Documentation Center

  • Trial Software
  • Product Updates

Height, Width

Heights and widths of canvases and scenes

Value Summary

Height, WidthInheritedPositive output size

Graphics Primitives

ObjectsDefault Values
plot::Canvas, plot::Scene2d, plot::Scene3d

Height: 80

Width: 120

Description

Height = h and Width = w set the size of the canvas or scene to the height h and the width w.

For the canvas, the width and the height should be specified as physical lengths with a unit, e.g., Width = 120*unit::mm, Height = 4.72*unit::inch. Numbers without a physical unit give the size in mm.

These values specify the (approximate) physical size of the canvas, with which the graphics appears on the screen. A printout of the MuPAD® graphics will have this physical size precisely.

The following picture illustrates the layout of the canvas:

The width and height of the canvas include the margin set by Margin and the border set by BorderWidth.

When only one scene is displayed in the canvas, this scene fills the canvas, i.e., the scene size coincides with the canvas size. When the canvas contains several scenes, there are various layout schemes, set by the canvas attribute Layout, to arrange the scenes in the canvas. Two schemes allow to set the size of the scenes indepently of the canvas size:

    Note:   For scenes, the attributes Width and Height are only used when plotting with the canvas attribute Layout set to Absolute or Relative.

With Layout = Absolute, width and height of a scene must be specified as physical lengths with a unit, e.g., Height = 40*unit::mm, Width = 2.4*unit::inch (missing units are assumed to be mm).

With Layout = Relative, width and height of a scene must be specified as fractions of the canvas widht and height, i.e., as numbers between 0 and 1.

The lower left corner of a scene can be moved to any position via the attributes Bottom and Left.

The following picture illustrates the layout of a scene:

The width and height of the scene include the margin set by Margin and the border set by BorderWidth.

If a scene exceeds the canvas, the corresponding parts of the scene are clipped.

Examples

Example 1

The following calls produce plots of the physical sizes 8 ×4 cm and 11 ×7 cm, respectively.

f := plot::Function2d(sin(x), x = 0..2*PI):
plot(f, Width = 80*unit::mm, Height = 4*unit::cm,
     BorderWidth = 1.0*unit::mm):

plot(f, Width = 110*unit::mm, Height = 7*unit::cm,
     BorderWidth = 1.0*unit::mm):

delete f:

Example 2

In the following graphics, we place two scenes in one canvas:

f1 := plot::Function2d(sin(x), x = 0..2*PI):
f2 := plot::Function2d(cos(x), x = 0..2*PI):
S1 := plot::Scene2d(f1, BorderWidth = 0.5*unit::mm,
                    Height = 7*unit::cm, Width = 11*unit::cm):
S2 := plot::Scene2d(f2, BorderWidth = 0.5*unit::mm,
                    Height = 3*unit::cm, Width = 5*unit::cm):
plot(S1, S2, Layout = Horizontal, BorderWidth = 1.0*unit::mm,
     Height = 7*unit::cm, Width = 11*unit::cm):

Note that with Layout = Horizontal, the size attributes of the scenes were ignored in the plot above. They affect the graphic when switching Layout to Absolute, either interactively in the inspector or directly in the plot call:

plot(S1, S2, Layout = Absolute, BorderWidth = 1.0*unit::mm,
     Height = 7*unit::cm, Width = 11*unit::cm):

Note that we did not set the attributes Bottom and Left of the scenes, so the bottom left corners of the scenes are placed in the bottom left corner of the canvas.

We make the background of the scene S2 transparent via BackgroundTransparent = TRUE and shift this scene via suitable values of Bottom and Left:

S2::BackgroundTransparent := TRUE:
S2::Bottom := 3.7*unit::cm:
S2::Left := 5.4*unit::cm:
plot(S1, S2, Layout = Absolute, BorderWidth = 1.0*unit::mm,
     Height = 7*unit::cm, Width = 11*unit::cm):

delete f1, f2, S1, S2:

See Also

MuPAD Functions

Was this topic helpful?