¿Cómo agrego un título a este diagtwig de Seaborne? Vamos a darle un título ‘YO SOY UN TÍTULO’.
tips = sns.load_dataset("tips") g = sns.FacetGrid(tips, col="sex", row="smoker", margin_titles=True) g.map(sns.plt.scatter, "total_bill", "tip")
Después de esas líneas:
plt.subplots_adjust(top=0.9) g.fig.suptitle('THIS IS A TITLE, YOU BET') # can also get the figure from plt.gcf()
Si agrega un suptítulo sin ajustar el eje, los títulos de facetas marinas se superponen.
(Con diferentes datos):
En el cuaderno de ipython, esto funcionó para mí!
sns.plt.title('YOUR TITLE HERE')
g.fig.subplots_adjust(top=0.9) g.fig.suptitle('Title', fontsize=16)
Más información aquí: http://matplotlib.org/api/figure_api.html
Lo que funcionó para mí fue:
sns.plt.suptitle('YOUR TITLE HERE')
Las respuestas que utilizan sns.plt.title()
y sns.plt.suptitle()
ya no funcionan.
En su lugar, necesitas usar la función title()
matplotlib:
import matplotlib.pyplot as plt sns.FacetGrid() plt.title("A title")