I have some very long xtick labels in a seaborn clustergram object and that I want to display in entirety. They get cut off by default. How do I adjust the margins/padding to account for this?
This did not work:
hm = sns.clustermap(df)
fig = hm.fig
fig.subplots_adjust(bottom=0.01)
fig.tight_layout(rect=[0, 0.03, 1, 0.95],pad=2)
fig.show()
And also throws a warning:
UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
warnings.warn("This figure includes Axes that are not compatible "
I have done sns.set(font_scale=0.5)
but this does not sufficiently address the problem.
Update
I was using subplots_adjust()
incorrectly, and as pointed out in the comments, tight_layout()
is not necessary. This works:
hm = sns.clustermap(df)
fig = hm.fig
fig.subplots_adjust(bottom=0.3)
fig.show()