Reputation: 16107
I'm creating a figure with two heat maps
fig, axs = plt.subplots(ncols=2, figsize=(20, 15))
heatmap(data1, cmap=color_palette('Greys_r'), square=True, ax=axs[0])
heatmap(data2, cmap=color_palette('Greys_r'), square=True, ax=axs[1])
fig.savefig('heatmap.png')
However, the resulting heatmaps are too small (or, the legends are too large)
I've tried setting figsize
to (20, 15)
, but it doesn't have any obvious effect. How can I fix this?
Upvotes: 1
Views: 387
Reputation: 39042
Probably an ugly hack where you have to manipulate the shrink
parameter manually but can be used for the current problem.
import numpy as np
import seaborn as sns
data1 = np.random.rand(10, 12)
data2 = np.random.rand(10, 12)
fig, axs = plt.subplots(ncols=2, figsize=(20, 15))
sns.heatmap(data1, cmap=sns.color_palette('Greys_r'), square=True, cbar_kws={"shrink": .42}, ax=axs[0])
sns.heatmap(data2, cmap=sns.color_palette('Greys_r'), square=True, cbar_kws={"shrink": .42}, ax=axs[1])
Upvotes: 1