Canvas

Canvas[]

represents an empty canvas in the current notebook in which you can do free-form drawing.

Canvas[graphic]

represents a canvas that initially contains the specified 2D graphic.

Details and Options

  • Clicking a canvas reveals a set of drawing tools that can be used to edit or annotate the content of the graphic.
  • Canvas[graphic] requires graphic to be a Graphics object, and it allows deep edits of the contents of graphic by the drawing tools.
  • Canvas[] is equivalent to Canvas[Graphics[]].
  • The following options can be given:
  • BackgroundNonebackground for the canvas
    BaseStyle{}base style specifications for the canvas
    FrameTruewhether to put a frame around the canvas
    FrameStyle{}style specifications for the frame
    ImageSizeAutomaticthe absolute size at which to render the canvas
  • If Canvas is given any other legal option for Graphics, the option will be applied directly to graphic.
  • If Background is given an expression that is not a color, the rendering of the expression is used as the background for the canvas. Background expressions are not editable by the drawing tools.
  • ImageSizeAutomatic will use the ImageSize of graphic if it is explicitly given. Otherwise, if Backgroundexpr specifies a background expression, the size of expr will be used. If neither of these conditions holds, then Automatic is equivalent to Medium.
  • Canvas can also wrap an existing Canvas expression, in which case the two expressions will be merged, with options for the outer Canvas overriding the options for the inner one.

Examples

open allclose all

Basic Examples  (2)

Create an empty canvas:

Wrap a canvas around a plot:

Wrap a canvas around the plot so the underlying plot cannot be altered:

Scope  (4)

Make a canvas of a Graphics expression:

Make a canvas of a two-dimensional plot:

Wrap Canvas around something that is already a canvas:

Apply a graphical option such as Axes to the first argument:

Properties & Relations  (3)

Wrapping an existing Canvas expression with Canvas merges the options of the two:

If the expressions have conflicting options, the outer Canvas overrides the inner one:

Convert a canvas to a graphic using Normal:

Normal strips the frame provided by Canvas:

Applying Normal to a Canvas with a background expression results in an expression that looks identical:

The input form of the resulting expression will be an Overlay:

Possible Issues  (2)

If a canvas cannot be selected, no drawing tools will be available:

If a canvas is in a non-editable environment, selecting the canvas will not produce drawing tools:

Wolfram Research (2020), Canvas, Wolfram Language function, https://reference.wolfram.com/language/ref/Canvas.html.

Text

Wolfram Research (2020), Canvas, Wolfram Language function, https://reference.wolfram.com/language/ref/Canvas.html.

CMS

Wolfram Language. 2020. "Canvas." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Canvas.html.

APA

Wolfram Language. (2020). Canvas. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Canvas.html

BibTeX

@misc{reference.wolfram_2024_canvas, author="Wolfram Research", title="{Canvas}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Canvas.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_canvas, organization={Wolfram Research}, title={Canvas}, year={2020}, url={https://reference.wolfram.com/language/ref/Canvas.html}, note=[Accessed: 21-December-2024 ]}