class seaborn.objects.Stack#

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


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())

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")
    .add(so.Bars(), so.Hist(binwidth=10), so.Stack())