自定义matplotlib上的颜色栏边框颜色 [英] Customizing colorbar border color on matplotlib

查看:551
本文介绍了自定义matplotlib上的颜色栏边框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改颜色条的边框,使它们是白色而不是黑色(外部边框以及每个段之间的边框)?

how can I change the colorbar borders so that they are white and not black (externals border and between each segment)?

例如:

x=randint(100, size=(10,10))
cs=contourf(x)
cb=colorbar(cs)

给予

但我想要:

谢谢

推荐答案

请注意以下有关MPL 1.3及更高版本的注释.

edit: Notice the comments below for MPL 1.3 and later.

添加:

cb=colorbar(cs, drawedges=True)

cb.outline.set_color('white')
cb.outline.set_linewidth(2)

cb.dividers.set_color('white')
cb.dividers.set_linewidth(2)

这篇关于自定义matplotlib上的颜色栏边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆