I displayed plot with the following command in jupyter notebook:
sns.heatmap(pcts, annot=True, linewidth=.1, vmax=99, fmt='.1f', cmap='YlOrRd', square=True, cbar=False)
plt.yticks(list(reversed(range(len(indices)))), ['Index '+str(x) for x in indices], rotation='horizontal')
plt.title('Percentile ranks of\nsamples\' category spending');
and got the following picture
i.e. squares appear unacceptably small.
How can I make them larger?
Create a dataframe using Pandas data frame. Create a heatmap using heatmap() method. To adjust the font size in Seaborn heatmap, change the fontsize value. To display the figure, use show() method.
The font size of the annotations is set by default, although it can be altered using the annot kws parameter of the heatmap() method. The annot kws is a dictionary-type option that requires a value for the size key. The size of the annotations is determined by the value assigned to this key.
Heatmaps in Seaborn can be plotted by using the seaborn. heatmap() function.
Before using heatmap()
, call matplotlib.pyplot.figure()
with the figsize
parameter to set the size of the figure. For example:
pyplot.figure(figsize=(10, 16))
sns.heatmap(...)
The two elements of the tuple passed to figsize
are the desired width and height of the figure in inches. Then when you make the heatmap, it will stretch to fill the available space given that size. You may have to do a bit of experimentation to determine what size looks best.
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