stat_identity ¶
stat_identity(
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,
color_by: str | None = None,
fill_by: str | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> FeatureSpec
Leave the data as it is (stat="identity"); drawn as points by default.
Useful to draw raw rows with any geom, for example stat_identity(geom="line").
stat_identity(...) is geom_point(stat="identity", ...); another geom draws the
same computed rows with that geom.
Parameters:
-
mapping(FeatureSpec, default:None) –Aesthetic mapping from
aes():x,y(required),color,fill,size,shape,alpha,stroke. -
data(DataFrame or dict, default:None) –Layer data; inherits the plot data when None.
-
geom(str, default:None) –Geom that draws the computed rows, by name;
"point"when None. -
position(str or FeatureSpec, default:None) –Position adjustment (
"identity"). -
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:
layer_tooltips(), a list of column names, or"none"to disable tooltips (HTML output). -
color_by(str, default:None) –Aesthetic the
colorscale applies to ("color"or"fill"). -
fill_by(str, default:None) –Aesthetic the
fillscale applies to ("fill"or"color"). -
na_rm(bool, default:None) –True removes rows with missing values silently; otherwise they are removed with a warning.
-
**other_args(Any) –Options of the geom and constant aesthetics such as
color="red".
Returns:
-
FeatureSpec–The layer.
Examples:
>>> from ggrust import *
>>> data = {"hour": [6, 9, 12, 15, 18], "temp": [9, 14, 19, 21, 16]}
>>> plot = ggplot(data, aes("hour", "temp")) + stat_identity(geom="line")