I'm using the Seaborn heatmap function with customized yticklabels. My labels are quite long, and they are being truncated even when I shrink the fontsize. Is there a way to allow longer visible tick labels?
ax = sns.heatmap(
pcolor_data,
xticklabels=day_columns,
yticklabels=line_sales_by_day['product_name'][0:n_skus].values,
annot=True,
cbar=True,
annot_kws={'size':10},
fmt='g',
cmap=cmap
)
Have you tried the tight_layout
option from matplotlib.pyplot
?
ax = sns.heatmap(...)
ax.figure.tight_layout()
Alternatively, you can control the edges of your subplot area with subplots_adjust
, a method of the plt.figure
instance, which you can access with ax.figure.subplots_adjust()
:
ax = sns.heatmap(...)
ax.figure.subplots_adjust(left = 0.3) # change 0.3 to suit your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With