Skip to content

Graphics

Wraps a list of 2D graphics primitives into a renderable object. Typical primitives: Line, Circle, Disk, Rectangle, Polygon, Point, Text, Arrow. Directives include Red, Blue, Dashed, Thickness[r], PointSize[r], Opacity[α], RGBColor[r,g,b].

$ wo 'Head[Graphics[{Red, Disk[]}]]'
Graphics

Sphere and Ball are drawn here too — in the plane a sphere is the circle bounding it and a ball the filled disk. That is how the circumcircle of three points reaches a picture, since Circumsphere returns a Sphere whatever the dimension:

$ wo 'Circumsphere[{{0, 0}, {4, 0}, {0, 3}}]'
Sphere[{2, 3/2}, 5/2]
$ wo 'StringContainsQ[ExportString[Graphics[{Circumsphere[{{0, 0}, {4, 0}, {0, 3}}]}], "SVG"], "<svg"]'
True

A Style around a label paints its Background behind the text, which is how a label stays readable over whatever it is placed on:

$ wo 'StringContainsQ[ExportString[Graphics[{Line[{{0, 0}, {4, 4}}], Style[Text["8", {2, 2}], Background -> White]}], "SVG"], "<svg"]'
True

Options

  • ImageSize, PlotRange, AspectRatio, Axes, Frame, FrameLabel, Background, PlotLabel, Epilog, Prolog — as for Plot.
  • FrameTicksFalse or None keeps the border but drops the tick marks and their labels.

An option may be written with :>, which holds its right-hand side until the option is used:

$ wo 't = 1100; StringContainsQ[ExportString[Graphics[{Disk[]}, PlotLabel :> Which[t == 1100, "met", True, ""]], "SVG"], "<svg"]'
True
$ wo 'StringContainsQ[ExportString[Graphics[{Line[{{0, 0}, {1, 1}}]}, Frame -> True, FrameTicks -> False], "SVG"], "<text"]'
False