stat_pointinterval ¶
stat_pointinterval(
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,
manual_key: ManualKey | None = None,
tooltips: Tooltips | None = None,
orientation: str | None = None,
point_interval: Literal | None = None,
widths: Sequence[float] | None = None,
interval_size_range: tuple[float, float] | None = None,
fatten_point: Number | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> LayerSpec
Point summary of y with quantile intervals around it, per x.
As stat_pointinterval in the R package ggdist, for sample data. One row
per interval level, widest first, with y the point, ymin/ymax the
interval, "...width.." the level and "..level.." the level as a
discrete value. Narrower intervals draw thicker.
Parameters:
-
mapping(FeatureSpec, default:None) –Aesthetic mapping from
aes(). Needsy(and usuallyx). -
data(DataFrame or dict, default:None) –Layer data; inherits the plot data when None.
-
geom(str, default:"pointinterval") –Geom that draws the intervals.
-
position(str or FeatureSpec, default:None) –Position adjustment, e.g.
position_dodge(width=0.9); none by default. -
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(). -
tooltips(FeatureSpec or list of str, default:None) –Tooltip content:
layer_tooltips(), a list of column names, or"none". -
orientation(str, default:None) –"y"draws along the y axis; a discrete y with a continuous x picks it. -
point_interval((median_qi, mean_qi, mode_qi), default:"median_qi") –The point (median, mean, or mode) with equal-tailed quantile intervals.
-
widths(list of float, default:[0.66, 0.95]) –Interval levels (ggdist's
.width), each in (0, 1]. -
interval_size_range(tuple of float, default:(0.78, 1.81)) –Line widths of the widest and the narrowest interval (ggdist's 0.6 and 1.4, converted to ggrust's units so plots look as in R).
-
fatten_point(float, default:2.5) –Point size as a multiple of the line width (ggdist's 1.8, converted).
-
na_rm(bool, default:None) –True removes rows with missing values silently.
-
**other_args(Any) –Constant aesthetics (
color,alpha,shape;linewidthandsizereplace the computed widths).
Returns:
-
LayerSpec–The layer.
Raises:
-
SpecError–If
point_intervalis not an accepted name, orwidthsorinterval_size_rangeholds an invalid value. -
UnsupportedValueError–If
widthsis not a list of numbers.
Examples:
>>> from ggrust import *
>>> data = {"diet": ["veg"] * 6 + ["meat"] * 6,
... "weight": [61, 58, 66, 70, 63, 59, 72, 80, 77, 69, 85, 74]}
>>> plot = ggplot(data, aes("diet", "weight")) + stat_pointinterval(widths=[0.5, 0.9])