Specify a layer of the visualization in terms of mark and data transform(s).
This is the main method for specifying how the data should be visualized.
It can be called multiple times with different arguments to define
a plot with multiple layers.
Objects representing transforms to be applied before plotting the data.
Currently, at most one Stat can be used, and it
must be passed first. This constraint will be relaxed in the future.
orient : “x”, “y”, “v”, or “h”
The orientation of the mark, which also affects how transforms are computed.
Typically corresponds to the axis that defines groups for aggregation.
The “v” (vertical) and “h” (horizontal) options are synonyms for “x” / “y”,
but may be more intuitive with some marks. When not provided, an
orientation will be inferred from characteristics of the data and scales.
legend : bool
Option to suppress the mark/mappings for this layer from the legend.
label : str
A label to use for the layer in the legend, independent of any mappings.
data : DataFrame or dict
Data source to override the global source provided in the constructor.
variables : data vectors or identifiers
Additional layer-specific variables, including variables that will be
passed directly to the transforms without scaling.
Layers have an “orientation”, which affects the transforms and some marks. The orientation is typically inferred from the variable types assigned to x and y, but it can be specified when it would otherwise be ambiguous:
Variables can be assigned to a specific layer. Note the distinction between how pointsize is passed to Plot.add — so it is mapped by a scale — while color and linewidth are passed directly to Line, so they directly set the line’s color and width: