Skip to main content

Drawing shapes

Aside from conventional plot types, it is possible to draw a selection of geometric primitives. These are

  • line for lines and arrows,
  • rect for rectangles,
  • ellipse for ellipses,
  • and path for arbitrary Bézier splines.

In addition, with

it is possible to add any content on top of the diagram.

These primitives can be especially useful since their positions (and partly also their dimensions) can be specified in

  • data coordinates (using int or float values),
  • or absolute coordinates (using length values like 10pt 3em), or
  • or relative diagram coordinates (using ratio values, e.g., 50% lies in the center of the diagram area), and in many cases even a combination of the above.

The Koch curve example demonstrates how to use path for drawing a fractal.