stat_sina ¶
stat_sina(
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,
orientation: str | None = None,
seed: int | None = None,
quantiles: Sequence[float] | None = None,
scale: Literal["area", "count", "width"] | None = None,
trim: bool | None = None,
tails_cutoff: Number | None = None,
kernel: str | None = None,
bw: str | Number | None = None,
adjust: Number | None = None,
n: int | None = None,
fs_max: Number | None = None,
color_by: str | None = None,
fill_by: str | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> FeatureSpec
Points spread within the density of y per x (stat="sina"), as a sina plot.
stat_sina(...) is geom_sina(stat="sina", ...); another geom draws the
same computed rows with that geom.
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:None) –Geom that draws the computed rows, by name;
"sina"when None. -
position(str or FeatureSpec, default:None) –Position adjustment: a name such as
"dodge"or aposition_*()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:
layer_tooltips(), a list of column names, or"none"to disable tooltips (HTML output). -
orientation(str, default:None) –"y"draws along the y axis; a discrete y with a continuous x picks it by default. -
seed(int, default:None) –Random seed, for reproducible results.
-
quantiles(list of float, default:None) –Quantiles to draw lines at, each in [0, 1].
-
scale((area, count, width), default:"area") –If "area", all groups have the same area. If "count", areas are scaled proportionally to the number of observations. If "width", all groups have the same maximum width.
-
trim(bool, default:None) –True trims the density to the data range.
-
tails_cutoff(float, default:None) –Density tails are cut where the density falls under this share of the maximum.
-
kernel(str, default:None) –Kernel of the density estimate, e.g.
"gaussian". -
bw(str or float, default:None) –Bandwidth: a number or a rule name such as
"nrd0". -
adjust(float, default:None) –Multiplier of the bandwidth.
-
n(int, default:None) –Number of points the density is evaluated at.
-
fs_max(float, default:None) –Upper bound of the number of points the density is evaluated at.
-
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 = {"day": ["Mon"] * 6 + ["Tue"] * 6,
... "minutes": [12, 15, 14, 16, 13, 15, 20, 22, 19, 21, 18, 20]}
>>> plot = ggplot(data, aes("day", "minutes")) + stat_sina(seed=1)