Skip to content

geom_text_repel

geom_text_repel(
    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,
    map: PlotData | None = None,
    map_join: str | Sequence[str] | None = None,
    use_crs: str | None = None,
    label_format: str | None = None,
    na_text: str | None = None,
    halo_width: Number | None = None,
    halo_color: Color | None = None,
    nudge_x: Number | None = None,
    nudge_y: Number | None = None,
    size_unit: str | None = None,
    nudge_unit: str | None = None,
    check_overlap: bool | None = None,
    color_by: str | None = None,
    seed: int | None = None,
    max_iter: int | None = None,
    max_time: Number | None = None,
    direction: int | None = None,
    point_padding: Number | None = None,
    box_padding: Number | None = None,
    max_overlaps: int | None = None,
    min_segment_length: Number | None = None,
    arrow: FeatureSpec | None = None,
    na_rm: bool | None = None,
    **other_args: Any,
) -> LayerSpec

Text labels pushed apart so they do not overlap each other or the points.

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

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

    Spatial data (lets_plot map); not supported by ggrust yet.

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

    Columns joining data to map (lets_plot); not supported by ggrust yet.

  • use_crs (str, default: None ) –

    Coordinate reference system for map (lets_plot); not supported by ggrust yet.

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

  • halo_width (float, default: None ) –

    Width of the halo around text.

  • halo_color (str, default: None ) –

    Color of the halo around text.

  • nudge_x (float, default: None ) –

    Horizontal offset of the labels.

  • nudge_y (float, default: None ) –

    Vertical offset of the labels.

  • size_unit (str, default: None ) –

    Relate size to an axis: "x", "y", "min" or "max".

  • nudge_unit (str, default: None ) –

    Unit of the nudge: "identity" (data units), "size", "px".

  • check_overlap (bool, default: None ) –

    True skips labels that overlap labels drawn before them.

  • color_by (str, default: None ) –

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

  • seed (int, default: None ) –

    Random seed, for reproducible results.

  • max_iter (int, default: None ) –

    Maximum number of iterations of the repel layout.

  • max_time (float, default: None ) –

    Maximum time of the repel layout, in seconds.

  • direction (int, default: None ) –

    Repel direction: "both", "x" or "y".

  • point_padding (float, default: None ) –

    Space kept free around each point.

  • box_padding (float, default: None ) –

    Space kept free around each label.

  • max_overlaps (int, default: None ) –

    Labels overlapping more than this many items are dropped.

  • min_segment_length (float, default: None ) –

    Shorter connector segments are not drawn.

  • arrow (FeatureSpec, default: None ) –

    Arrow spec from arrow().

  • na_rm (bool, default: None ) –

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

  • **other_args (Any) –

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

Returns:

  • LayerSpec –

    The layer.