I have a code that looks like this:
corr = sdf.corr(method="spearman")
corr.style.background_gradient(cmap='coolwarm')
I have an output of correlation graph. I saw online to use this code to save it as image
fig, ax = plt.subplots()
plt.figure(figsize = (16,8))
sns.heatmap(sdf.corr(method='spearman'), annot=True, fmt='.4f',
cmap=plt.get_cmap('coolwarm'), cbar=False, ax=ax)
ax.set_yticklabels(ax.get_yticklabels(), rotation="horizontal")
plt.savefig('result.png', bbox_inches='tight', pad_inches=0.0)
But this clogs the output like this:
How do I save this?
Edit:
Tried the answer below and it is showing this.