Skip to content

geom_spoke

geom_spoke(
    mapping: FeatureSpec | None = None,
    *,
    data: PlotData | 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,
    arrow: FeatureSpec | None = None,
    pivot: Literal["tail", "middle", "mid", "tip"]
    | None = None,
    na_rm: bool | None = None,
    color_by: str | None = None,
    **other_args: Any,
) -> LayerSpec

Draw a segment of length radius at angle radians through each point.

Parameters:

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping from aes().

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

    Layer data; inherits the plot data when None.

  • position (str or FeatureSpec, default: "identity" ) –

    Position adjustment.

  • show_legend (bool, default: True ) –

    False hides this layer from the legend.

  • inherit_aes (bool, default: True ) –

    False ignores the plot's mapping.

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

    A manual legend key for this layer.

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

    Result of a sampling_*() call.

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

    Result of layer_tooltips(), or "none".

  • arrow (FeatureSpec, default: None ) –

    Result of arrow().

  • pivot ((tail, middle, mid, tip), default: "tail" ) –

    The part of the segment that sits on the point.

  • na_rm (bool, default: False ) –

    True drops missing values without a warning.

  • color_by (str, default: None ) –

    Aesthetic the color scale of this layer reads.

  • **other_args (Any) –

    Constant aesthetics: x, y, angle, radius, size, linetype, color, alpha.

Returns:

  • LayerSpec –

    The layer.

Raises:

  • SpecError –

    If pivot is not one of the accepted values (when the plot is built).

Examples:

>>> from ggrust import *
>>> data = {"x": [0, 1, 2], "y": [0, 0, 0], "angle": [0.5, 1.0, 1.5], "speed": [1, 2, 1]}
>>> plot = ggplot(data, aes("x", "y")) + geom_spoke(aes(angle="angle", radius="speed"))