Back to Seaborn

Objects.Range

doc/_docstrings/objects.Range.ipynb

0.13.21010 B
Original Source
python
import seaborn.objects as so
from seaborn import load_dataset
penguins = load_dataset("penguins")
python
(
    so.Plot(penguins, x="body_mass_g", y="species", color="sex")
    .add(so.Dot(), so.Agg(), so.Dodge())
    .add(so.Range(), so.Est(errorbar="sd"), so.Dodge())
)
python
(
    so.Plot(penguins, x="sex", y="body_mass_g", linestyle="species")
    .facet("species")
    .add(so.Line(marker="o"), so.Agg())
    .add(so.Range(), so.Est(errorbar="sd"))
)
python
(
    penguins
    .rename_axis(index="penguin")
    .pipe(so.Plot, x="penguin", ymin="bill_depth_mm", ymax="bill_length_mm")
    .add(so.Range(), color="island")
)

When min/max variables are neither computed as part of a transform or explicitly assigned, the range will cover the full extent of the data at each unique observation on the orient axis:

python
(
    so.Plot(penguins, x="sex", y="body_mass_g")
    .facet("species")
    .add(so.Dots(pointsize=6))
    .add(so.Range(linewidth=2))
)