Sep-08-2019, 11:12 AM
Hi Rajesh,
When we create seaborn heatmap then automatically color bar also generate. Depend on creator requirement, we can modify it. You want to display ticks, so use cbar_kws sns.heatmap() parameter and pass keys(ticks) and values mapping for change the style and format of seaborn heatmap color bar
When we create seaborn heatmap then automatically color bar also generate. Depend on creator requirement, we can modify it. You want to display ticks, so use cbar_kws sns.heatmap() parameter and pass keys(ticks) and values mapping for change the style and format of seaborn heatmap color bar
import numpy as np; np.random.seed(0) import seaborn as sns; sns.set() uniform_data = np.random.rand(10, 12) # color bar keyword arguments cbar_kws = {"shrink":1, 'extend':'min', 'extendfrac':.1, "drawedges":True, 'ticks': [0.0, 0.2, 0.4, 0.5, 0.7, 0.8, 1.0], # set ticks of color bar 'label':'Color Bar'} ax = sns.heatmap(uniform_data, cbar_kws=cbar_kws, vmin=0, vmax=1)