Set Max value for color bar on seaborn heatmap

后端 未结 1 1973
[愿得一人]
[愿得一人] 2020-12-17 08:05

I need to set the max value on the seaborn heatmap cbar to 2. I\'ve tried:

cbar_kws = { \'ticks\' : [0, 2] }
sns.heatmap(tiles, robust=True, fmt         


        
相关标签:
1条回答
  • 2020-12-17 09:01

    I think you want to use the vmin and vmax parameters for the heatmap, as described in the docs:

    vmin, vmax : floats, optional

    Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments.

    sns.heatmap(tiles, robust=True, fmt="f", cmap='RdBu_r', vmin=0, vmax=2)
    
    0 讨论(0)
提交回复
热议问题