如何调整(偏移)在matplotlib彩条标题 [英] How do I adjust (offset) colorbar title in matplotlib

查看:846
本文介绍了如何调整(偏移)在matplotlib彩条标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于以下code:

  imshow(np.arange(16 * 16).reshape(16,16))
CB =彩条()
cb.set_label(富)
cb.set_ticks([0,255])
 

主要生产:

我如何调整彩条文富,使其向左偏移,介乎0至255,更接近彩条,减少非必要的空白?

解决方案

  cb.set_label(富,labelpad = -1)
 

负labelpad值将逐渐接近了吧,正走。

Given the following code:

imshow(np.arange(16*16).reshape(16,16))
cb = colorbar()
cb.set_label("Foo")
cb.set_ticks([0,255])

Which produces:

How do I adjust the colorbar text "Foo" so that it is offset to the left, betwen the 0 and 255, closer to the colorbar, reducing the un-needed whitespace?

解决方案

cb.set_label("Foo", labelpad=-1)

Negative labelpad values will move closer to the bar, positive away.

这篇关于如何调整(偏移)在matplotlib彩条标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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