Layer Grouping

To plot complex layers, whitecanvas uses the layer-grouping architecture. There are several built-in layer groups.

  • PlotLine + Markers

  • LineBandLine + Band

  • LabeledLineLine + Errorbar x2 + Texts

  • LabeledMarkersMarkers + Errorbar x2 + Texts

  • LabeledBarsBars + Errorbar x2 + Texts

  • LabeledPlotPlot + Errorbar x2 + Texts

  • StemMarkers + MultiLine

  • GraphMarkers + MultiLine + Texts

These layer groups can be derived from primitive layers.

from whitecanvas import new_canvas

canvas = new_canvas("matplotlib")

canvas.add_line(
    [0, 1, 2], [3, 2, 1], color="black",
).with_markers(
    symbol="o", color="red"
)

canvas.add_markers(
    [0, 1, 2], [3, 2, 1], symbol="o", color="red"
).with_lines(
    color="black"
)