seaborn.objects.Range#

class seaborn.objects.Range(artist_kws=<factory>, color=<'C0'>, alpha=<1>, linewidth=<rc:lines.linewidth>, linestyle=<rc:lines.linestyle>)#

An oriented line mark drawn between min/max values.

This mark defines the following properties:

color, alpha, linewidth, linestyle

Examples

This mark will often be used in the context of a stat transform that adds an errorbar interval:

(
    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())
)
../_images/objects.Range_1_0.png

One feature (or potential gotcha) is that the mark will pick up properties like linestyle and linewidth; exclude those properties from the relevant layer if this behavior is undesired:

(
    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="pi"))
)
../_images/objects.Range_3_0.png

It’s also possible to directly assign the minimum and maximum values for the range:

(
    penguins
    .rename_axis("penguin")
    .pipe(so.Plot, ymin="bill_depth_mm", ymax="bill_length_mm", x="penguin")
    .add(so.Range(), color="island", linewidth="body_mass_g")
    .scale(x=so.Continuous().tick(count=0), linewidth=(.5, 1.5))
    .facet(row="species", col="sex")
    .layout(size=(8, 4))
    .share(x=False)
    .label(x="", y="Size (mm)")
)
../_images/objects.Range_5_0.png