stat_hull ¶
stat_hull(
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
Draw the convex hull of each group (stat="hull"), as plotnine.
The hull's vertices run counter-clockwise and the first is repeated at the end,
so the default geom_path closes it; geom="polygon" fills it. Computes
..area.., the enclosed area. Groups of fewer than three non-collinear points
draw nothing.
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:"path") –Geom that draws the hull, e.g.
"polygon". -
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 = {"height": [150, 160, 170, 165, 180, 175], "weight": [50, 62, 70, 58, 85, 72],
... "team": ["a", "a", "a", "b", "b", "b"]}
>>> plot = ggplot(data, aes("height", "weight", color="team")) + geom_point()
>>> plot = plot + stat_hull()