热图 Cbar 调整颜色渐变
我尝试调整我的 cbar 颜色,但遇到了困难:
当我使用:Center=None
时,我有以下栏:
当我使用 Center=0 时
,我有以下栏:
但这不是我所排除的:我的目标是从零开始为红色,并且值小于 0 时变得越来越红。
所以条形图应该看起来像这样的东西即:
这样,它会更具可读性:红色负数 - 绿色正数
(红色越多,负数越多 - 绿色越多,正数越多)
下面是我的代码行:
ax = sns.heatmap(result, linewidth=0.1,cmap="RdYlGn",
cbar_kws=dict(ticks= [result.min()/2,.0,result.max()/2]),
center=None,vmin=result.min(),vmax=result.max(),robust=True,fmt="f")
似乎 vmin
和 vmax
无法正常工作
I try to adjust my cbar color but struggling with it :
When I use : Center=None
I have the following bar :
And When I use Center=0
, I have the following bar :
But it is not what I except : My goal is to have red starting at zero and being more and more red more the value is less than 0.
So the bar should look Like stuff like that :
So like this it will be more readable : Red Negative - Green Positive
(More its Red More its negative - More its Green more it is positive)
Below is my line of code :
ax = sns.heatmap(result, linewidth=0.1,cmap="RdYlGn",
cbar_kws=dict(ticks= [result.min()/2,.0,result.max()/2]),
center=None,vmin=result.min(),vmax=result.max(),robust=True,fmt="f")
It seems that vmin
and vmax
does not work as excepted
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎想要一个以不同方式压缩两个部分的
TwoSlopeNorm
。 (默认使用对称着色。)You seem to want a
TwoSlopeNorm
which compresses both parts differently. (The default uses symmetric coloring.)