seaborn.objects.Stack#

class seaborn.objects.Stack#

Displacement of overlapping bar or area marks along the value axis.

Examples

This transform applies a vertical shift to eliminate overlap between marks with a baseline, such as Bar or Area:

so.Plot(titanic, x="class", color="sex").add(so.Bar(), so.Count(), so.Stack())
../_images/objects.Stack_1_0.png

Stacking can make it much harder to compare values between groups that get shifted, but it can work well when depicting a part-whole relationship:

(
    so.Plot(titanic, x="age", alpha="alive")
    .facet("sex")
    .add(so.Bars(), so.Hist(binwidth=10), so.Stack())
)
../_images/objects.Stack_3_0.png