Skip to content

geom_label

geom_label(
    mapping: FeatureSpec | None = None,
    *,
    data: PlotData | None = None,
    stat: str | None = None,
    position: Position | None = None,
    show_legend: bool | None = None,
    inherit_aes: bool | None = None,
    manual_key: ManualKey | None = None,
    sampling: Sampling | None = None,
    tooltips: Tooltips | None = None,
    label_format: str | None = None,
    na_text: str | None = None,
    nudge_x: Number | None = None,
    nudge_y: Number | None = None,
    label_padding: Number | None = None,
    label_r: Number | None = None,
    label_size: Number | None = None,
    na_rm: bool | None = None,
    **other_args: Any,
) -> LayerSpec

Text labels in a rounded box at (x, y).

Parameters:

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping from aes().

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

    Layer data; inherits the plot data when None.

  • stat (str, default: None ) –

    Statistical transformation, by name.

  • 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).

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

    lets_plot sampling; accepted and ignored, as ggrust draws every row.

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

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

  • label_format (str, default: None ) –

    Format pattern of the label text, e.g. ".2f" or "{d} %".

  • na_text (str, default: None ) –

    Text shown for missing values.

  • nudge_x (float, default: None ) –

    Horizontal offset of the labels.

  • nudge_y (float, default: None ) –

    Vertical offset of the labels.

  • label_padding (float, default: None ) –

    Space between the text and the label border.

  • label_r (float, default: None ) –

    Radius of the label corners.

  • label_size (float, default: None ) –

    Width of the label border line.

  • na_rm (bool, default: None ) –

    True removes rows with missing values silently; otherwise they are removed with a warning.

  • **other_args (Any) –

    Constant aesthetics such as color="red" or size=2, and the geom's options. As in lets_plot; options ggrust does not read yet are reported as not supported.

Returns:

  • LayerSpec –

    The layer.