Layout of Canvas and Scenes

Layout of the Canvas

The following canvas attributes are relevant for its layout and its style.

attribute name possible values/example meaning default
Width12*unit::cmphysical width of the canvas 120*unit::mm
Height8*unit::cmphysical height of the canvas 80*unit::mm
BackgroundColorRGB color color of the background RGB::White
BorderColorRGB color color of the border RGB::Grey50
BorderWidth1*unit::mmwidth of the border 0
Margin1*unit::mmcommon width for all margins: BottomMargin, LeftMargin, etc. 1*unit::mm
BottomMargin1*unit::mmwidth of the bottom margin 1*unit::mm
LeftMargin1*unit::mmwidth of the left margin 1*unit::mm
RightMargin1*unit::mmwidth of the right margin 1*unit::mm
TopMargin1*unit::mmwidth of the top margin 1*unit::mm
Footerstring footer text "" (no footer)
Headerstring header text "" (no header)
FooterAlignmentLeft, Center, Righthorizontal footer alignment Center
HeaderAlignmentLeft, Center, Righthorizontal header alignment Center
FooterFontsee section Fontsfont for the footer sans-serif 12
HeaderFontsee section Fontsfont for the header sans-serif 12
LayoutTabular, Horizontal, Vertical, Absolute, Relative automatic or user-defined layout? Tabular
Rowsinteger > 0number of rows in automatic tabular layout mode  
Columnsinteger > 0number of columns in automatic tabular layout mode  
Spacing1.0*unit::mmspace between scenes 1.0*unit::mm

A canvas may contain one or more scenes. The following picture shows a canvas with four scenes to illustrate the meaning of the layout attributes BorderWidth, BottomMargin, LeftMargin, RightMargin, TopMargin, and Spacing:

The basic attribute that switches between "automatic" and "user-defined" layout is Layout:

  • With the default setting Layout = Tabular, a sequence of scenes in a canvas is displayed as a graphical array. The number of columns or rows of this array may be chosen via the attributes Columns or Rows, respectively. If none of these attributes is specified, the tabular layout scheme chooses some suitable values automatically.

  • The setting Layout = Horizontal places the scenes side by side in a single row. It is a shortcut for the setting Layout = Tabular, Rows = 1:

  • The setting Layout = Vertical places the scenes one below the other in a single column. It is a shortcut for the setting Layout = Tabular, Columns = 1:

The settings Layout = Absolute and Layout = Relative switch the automatic layout mode off and allow to position each scene via the scene attributes Left and Bottom. These attributes determine the position of the lower left corner of the scene and can be set separately for each scene.

  • With Layout = Absolute, the values for the lower left corner of the scene as well as its width and height may be specified as absolute physical lengths such as Left = 3.0*unit::mm, Bottom = 4.5*unit::mm, Width = 10*unit::cm, Height = 4*unit::inch.

  • With Layout = Relative, these values may be specified as fractions of the canvas height and width. E.g.,

    Layout = Relative,

    Left = 0.3, Bottom = 0.2,

    Width = 0.5, Height = 0.5

    is equivalent to

    Layout = Absolute,

    Left = 0.3*canvaswidth, Bottom = 0.2*canvasheight,

    Width = 0.5*canvaswidth, Height = 0.5*canvasheight,

    where canvaswidth and canvasheight are the physical width and height of the canvas.

The following command uses Layout = Relative to position 3 scenes by specifying the lower left corner together with their widths and heights as fractions of the canvas dimensions:

Left1 := 0.1:  Bottom1 := 0.06: Width1 := 0.60: Height1 := 0.8:
Left2 := 0.6:  Bottom2 := 0.5:  Width2 := 0.35: Height2 := 0.45:
Left3 := 0.75: Bottom3 := 0.2:  Width3 := 0.22: Height3 := 0.35:
plot(plot::Canvas(
       BorderWidth = 0.5*unit::mm,
       BackgroundColor = RGB::Grey,
       plot::Scene2d(plot::Rectangle(-1.2..1.2, -1.2..1.2), 
                     Left = Left1, Bottom = Bottom1, 
                     Width = Width1, Height = Height1),
       plot::Scene2d(plot::Rectangle(-1.2..1.2, -1.2..1.2), 
                     Left = Left2, Bottom = Bottom2,
                     Width = Width2, Height = Height2),
       plot::Scene2d(plot::Rectangle(-1.2..1.2, -1.2..1.2), 
                     Left = Left3, Bottom = Bottom3,
                     Width = Width3, Height = Height3),
       Header = "The Canvas Header", Layout = Relative,
       Width  = 110*unit::mm, Height = 90*unit::mm)):

In detail:

Layout of Scenes

The following scene attributes are relevant for the layout and the style of a scene:

Layout and style parameters for scenes

attribute name possible values/example meaning default
Width0.8, 12*unit::cmwidth of the scene (relative or absolute value) automatic
Height0.8, 8*unit::cmheight of the scene (relative or absolute value) automatic
BackgroundColorRGB color color of the background RGB::White
BackgroundColor2RGB color secondary color for color blend (3D only) RGB::Grey75
BackgroundStyleFlat, LeftRight, Pyramid, TopBottomstyle of color blend (3D only) FLAT
BackgroundTransparentTRUE, FALSEbackground transparent or opaque? FALSE
BorderColorRGB color color of the border RGB::SlateGrey
BorderWidth1*unit::mmwidth of the border 0
Margin1*unit::mmcommon width for all margins: BottomMargin, LeftMargin, etc. 1*unit::mm
BottomMargin1*unit::mmwidth of the bottom margin 1*unit::mm
LeftMargin1*unit::mmwidth of the left margin 1*unit::mm
RightMargin1*unit::mmwidth of the right margin 1*unit::mm
TopMargin1*unit::mmwidth of the top margin 1*unit::mm
Footerstring footer text "" (no footer)
Headerstring header text "" (no header)
FooterAlignmentLeft, Center, Righthorizontal footer alignment Center
HeaderAlignmentLeft, Center, Righthorizontal header alignment Center
FooterFontsee section Fontsfont for the footer sans-serif 12
HeaderFontsee section Fontsfont for the header sans-serif 12
LegendVisibleTRUE, FALSElegend on/off FALSE
LegendAlignmentCenter, Left, Righthorizontal legend alignment Center
LegendPlacementBottom, Topvertical legend placement Bottom
Left0.1, 1.0*unit::mmdistance of the left side of the scene to the left side of the canvas (relative or absolute value) 0
Bottom0.1, 1.0*unit::mmdistance of the bottom side of the scene to the bottom side of the canvas (relative or absolute value) 0
    

Similar to the canvas, scenes can have a border (set via BorderWidth and BorderColor). There is a (small) margin into which no graphical content is rendered. Further, a header and a footer can be specified:

Was this topic helpful?