Skip to content

geom_function

geom_function(
    mapping: FeatureSpec | None = None,
    *,
    data: PlotData | None = None,
    stat: str | None = None,
    geom: str | None = None,
    position: Position | None = None,
    show_legend: bool | None = None,
    inherit_aes: bool | None = None,
    manual_key: ManualKey | None = None,
    tooltips: Tooltips | None = None,
    fun: Function | None = None,
    xlim: Sequence[Number] | None = None,
    n: int | None = None,
    color_by: str | None = None,
    **other_args: Any,
) -> LayerSpec

Evaluate fun at x values and draw the result.

Parameters:

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping; x may name a column of data or be a list of values.

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

    Data holding the x column; a y column with the results is added.

  • stat (str, default: "identity" ) –

    Stat of the layer.

  • geom (str, default: "line" ) –

    Geom of the layer.

  • fun (callable, default: None ) –

    Function of one number; None gives an empty y.

  • xlim (list of float, default: None ) –

    [low, high] of the evaluated x range when x is not mapped (default [0, 1]).

  • n (int, default: None ) –

    Number of evaluated points in xlim (default 512).

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

    Position adjustment: a name such as "dodge" or a position_*() spec.

  • show_legend (bool, default: None ) –

    False hides this layer from the legend.

  • inherit_aes (bool, default: None ) –

    False ignores the plot's default mapping for this layer.

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

    A legend key for this layer, as in lets_plot; not supported yet (ggrust warns).

  • tooltips (FeatureSpec or list of str, default: None ) –

    Tooltip content: layer_tooltips(), a list of column names, or "none" to disable tooltips (HTML output).

  • color_by (str, default: None ) –

    Aesthetic the color scale applies to ("color" or "fill").

  • **other_args (Any) –

    Constant aesthetics and the geom's options, as in lets_plot.

Returns:

  • LayerSpec –

    The layer.