Skip to content

ferrum.layer

Layer descriptor for multi-mark charts.

Internal layer wrapper used by composite-mark expansion.

Layer

Single rendering layer inside a multi-layer Chart.

Most multi-layer charts are built via the + operator on two Chart instances (chart1 + chart2). Direct construction of Layer objects is rarely needed outside of ferrum internals and composite-mark expansion code.

Parameters:

Name Type Description Default
data object

DataFrame or Arrow-compatible object for this layer. When None the layer inherits data from the parent ChartSpec.

None
mark str or MarkSpec

Mark type string (e.g. "point", "line") or a MarkSpec object.

None
encoding dict

Mapping of channel names to ChannelBase objects. Defaults to an empty dict when omitted.

None
transforms list

Sequence of transform objects applied to this layer's data before rendering. Defaults to an empty list when omitted.

None
mark_kwargs dict

Extra keyword arguments forwarded to the mark renderer (e.g. {"dx": 5, "opacity": 0.7}).

None

Examples:

>>> from ferrum.layer import Layer
>>> layer = Layer(mark="text", encoding={"x": "x", "y": "y"}, mark_kwargs={"dx": 5})