stat_unique ¶
stat_unique(
mapping: FeatureSpec | None = None,
*,
data: PlotData | None = None,
geom: str | None = None,
position: Position | None = None,
show_legend: bool | None = None,
inherit_aes: bool | None = None,
tooltips: Tooltips | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> LayerSpec
Drop duplicate rows before drawing (stat="unique"), as ggplot2.
Rows count as duplicates when every mapped aesthetic and the group are equal; the first one is kept. Useful to draw one label or point per repeated value.
Parameters:
-
mapping(FeatureSpec, default:None) –Aesthetic mapping from
aes(). -
data(DataFrame or dict, default:None) –Layer data; inherits the plot data when None.
-
geom(str, default:"point") –Geom that draws the rows.
-
position(str or FeatureSpec, default:None) –Position adjustment: a name 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.
-
tooltips(FeatureSpec or list of str, default:None) –Tooltip content, or
"none"(HTML output). -
na_rm(bool, default:None) –True removes rows with missing values silently.
-
**other_args(Any) –Constant aesthetics and the geom's options.
Returns:
-
LayerSpec–The layer.
Examples:
>>> from ggrust import *
>>> data = {"city": ["Oslo", "Oslo", "Rome", "Rome"], "temp": [4, 4, 18, 18]}
>>> plot = ggplot(data, aes("city", "temp")) + stat_unique(geom="text", label="here")