2013-05-20 86 views
4

我对所有的地块可以进行垂直colorbars都勾上他们的标记是面部向内matplotlib例子画廊注意到,如何将matplotlib colorbar刻度标记更改为朝外?

即从酒吧的边缘到酒吧的有色区域) 。

对于我正在使用的情节和颜色块的类型,最好将刻度线朝外。

我怎么会从matplotlib画廊(见下文)已经向外的彩条面对的刻度标记修改这个简单的例子吗?

from matplotlib.colors import LogNorm 
from pylab import * 

#normal distribution center at x=0 and y=5 
x = randn(100000) 
y = randn(100000)+5 

hist2d(x, y, bins=40, norm=LogNorm()) 
colorbar() 
show() 
+0

可能重复http://stackoverflow.com/questions/14711338/ matplotlib-ticks-position-relative-to-axis) – tacaswell

回答

7

只需设置tick_params为彩条:

from matplotlib.colors import LogNorm 
from pylab import * 

#normal distribution center at x=0 and y=5 
x = randn(100000) 
y = randn(100000)+5 

hist2d(x, y, bins=40, norm=LogNorm()) 
colorbar().ax.tick_params(axis='y', direction='out') 
show() 

Colorbar with ticks out

的[matplotlib蜱相对位置轴(
+0

谢谢 - 非常有帮助! – user2401472

相关问题