I tried to find a way to add a separate suptitle to a set of subplots created using the seaborn.objects API. However, I couldn't find any such examples in the the docs. Is there a way to do this?
I have tried adding a suptitle using label and although it does not throw an error it does not do anything.
p = (
so.Plot(data, x="time", y="value", color='cols')
.add(so.Area(alpha=0.9), so.Stack())
.scale(color=colors)
)
(
p.label(suptitle=f'Good')
.label(x='Time (min)', y='Fraction', color='')
.limit(y=(0, 1), x=(0, 247.5))
.facet("posnum", wrap=3)
.share(y=True, x=True)
.layout(size=(10,10))
.label(suptitle=f'Good')
)
In the seaborn.objects API, adding a title or suptitle to a facet plot isn't directly supported as a method or attribute within the objects API itself. Instead, you can utilize the underlying matplotlib functions to achieve this, as the seaborn plots are built on top of matplotlib.
After you have created your facet plot using the seaborn.objects API, you can add a suptitle by accessing the matplotlib figure object that seaborn is using under the hood. Here is how you can modify your code to include a suptitle: