Skip to content

layer

layer(
    geom: str | None = None,
    stat: str | None = None,
    data: PlotData | None = None,
    mapping: FeatureSpec | None = None,
    position: Position | None = None,
    **kwargs: object,
) -> LayerSpec

Create a layer from a geom name, stat, data, mapping and position.

Parameters:

  • geom (str, default: None ) –

    Geom name, e.g. "point".

  • stat (str, default: None ) –

    Stat name, e.g. "identity".

  • data (DataFrame or dict, default: None ) –

    Layer data; inherits the plot data when None.

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping from aes().

  • position (str or FeatureSpec, default: None ) –

    Position adjustment.

  • **kwargs (object) –

    Constant aesthetics (color="red") and geom/stat options.

Returns:

  • LayerSpec –

    The layer.