geom_rug ¶
geom_rug(
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,
sides: str | None = None,
length: Number | None = None,
outside: bool | None = None,
color: Color | None = None,
alpha: Number | None = None,
linewidth: Number | None = None,
linetype: str | int | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> LayerSpec
Rug ticks along the panel edges, one per x and/or y value (ggplot2 geom_rug).
A tick per row marks where its value lies, as a compact marginal distribution
beside points. lets-plot has no geom_rug; this is ggplot2's.
Parameters:
-
mapping(FeatureSpec, default:None) –Aesthetic mapping from
aes();xticks the bottom/top edge,ythe left/right edge. Map at least one. -
data(DataFrame or dict, default:None) –Layer data; inherits the plot data when None.
-
stat(str, default:None) –Statistical transformation, by name (default
"identity"). -
position(str or FeatureSpec, default:None) –Position adjustment, e.g.
"jitter"for tied values. -
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) –This layer's key in a manual legend: a label, or
layer_key(). -
sides(str, default:"bl") –Edges that get ticks: any of
"t"(top),"r"(right),"b"(bottom),"l"(left). x values useb/t, y valuesl/r. -
length(float, default:0.03) –Tick length as a share of the panel (its height for x ticks, width for y ticks).
-
outside(bool, default:False) –True points the ticks away from the panel. As in ggplot2 they are then clipped by the panel; ggrust has no
clip="off"yet, so they are not visible and a :class:GgrustWarningsays so. -
color(str, default:None) –Tick color.
-
alpha(float, default:None) –Tick opacity, 0 to 1.
-
linewidth(float, default:0.5) –Tick width, in ggrust line units (as
sizeofgeom_segment). -
linetype(str or int, default:None) –Tick line type.
-
na_rm(bool, default:None) –True removes rows with missing values silently; otherwise they are removed with a warning.
-
**other_args(Any) –Other constant aesthetics, as in lets_plot.
Returns:
-
LayerSpec–The layer.
Raises:
-
SpecError–If
sideshas a letter other than t, r, b, l, orlengthis negative.
Examples:
>>> from ggrust import *
>>> data = {"height": [150, 162, 171, 158, 180, 166], "weight": [52, 60, 72, 55, 85, 63]}
>>> plot = ggplot(data, aes("height", "weight")) + geom_point() + geom_rug()