Seaborn setting titles and stuff through matplotlib's axis .set() function
For titles I was using sns.histplot(..).set(title="My title")
, but I couldn’t find any documentation for that .set()
function in the seaborn docu.
Seaborn’s FAQ (“How can I can I change something about the figure?”) led me here: matplotlib.axes.Axes.set — Matplotlib 3.7.1 documentation
It’s actually a matplotlib function!
(TODO: understand much better how seaborn exposes matplotlib’s internals. Then I can google for matplotlib stuff too)
Bonus: setting figure title for each facet of a FacetGrid AND the entire figure
You can access the matplotlib Figure
through .fig
, then use
matplotlib.pyplot.suptitle — Matplotlib 3.7.1 documentation
for the main figure title!
x = sns.displot(
data=xxx,
x='items_available',
col="item.item_category",
).set_titles(col_template="{col_name}") # Title template for each facet
# Main figure title, through matplotlib Figure
x.fig.suptitle("Distribution of sums of all items_available per time.pull",va='bottom')
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus