More seaborn notes
TODO: merge into 230525-1304 Seaborn how-to guide and use right terminology
Titles (figure-level)
(axis-level: sns.relplot, figure-level:sns.catplot)
Simple titles
sns.catplot(..)
plt.title("mytitle")
Titles overlapping facet text
Previously: 230515-2257 seaborn setting titles etc. with matplotlib set Key:
g = sns.catplot(...)
g.set_axis_labels("Width", "Equals (acc.)")
# # not needed if you do tight_layout()
# g.fig.subplots_adjust(top=0.85)
g.fig.suptitle("Masking and breaking words makes everything worse")
plt.tight_layout()
plt.show()
Fuller example from Change Axis Labels, Set Title and Figure Size to Plots with Seaborn - GeeksforGeeks:
# Plot scatter plot
g = sns.relplot(data = tips , x = "total_bill" ,
y = "tip" , col = "time" ,
hue = "day" , style = "day" ,
kind = "scatter" )
# Title for the complete figure
g.fig.suptitle("Tips by time of day" ,
fontsize = 'x-large' ,
fontweight = 'bold' )
# Adjust subplots so that titles don't overlap
g.fig.subplots_adjust( top = 0.85 )
# Set x-axis and y-axis labels
g.set_axis_labels( "Tip" , "Total Bill (USD)" )
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus