python 3.x - Seaborn Heatmap Colorbar Label as Percentage -


given heat map:

import numpy np; np.random.seed(0) import seaborn sns; sns.set() uniform_data = np.random.rand(10, 12) ax = sns.heatmap(uniform_data) 

how go making color bar values display in percent format? also, if wanted show first , last values on color bar?

thanks in advance!

iterating on solution of @mwaskom, without creating colorbar yourself:

import numpy np import seaborn sns data = np.random.rand(8, 12) ax = sns.heatmap(data, vmin=0, vmax=1) cbar = ax.collections[0].colorbar cbar.set_ticks([0, .2, .75, 1]) cbar.set_ticklabels(['low', '20%', '75%', '100%']) 

custom seaborn heatmap color bar labels


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -