如何将matplotlib颜色条记号更改为朝外?

如何将matplotlib颜色条记号更改为朝外?,matplotlib,colorbar,Matplotlib,Colorbar,我在matplotlib示例库中注意到,所有以垂直色条为特征的绘图上都有向内的记号 (即从棒的边缘进入棒的彩色区域) 对于我正在使用的绘图和色标类型,最好将记号标记朝外 如何修改matplotlib库(见下文)中的这个简单示例,使其颜色栏上有朝外的记号 from matplotlib.colors import LogNorm from pylab import * #normal distribution center at x=0 and y=5 x = randn(100000) y =

我在matplotlib示例库中注意到,所有以垂直色条为特征的绘图上都有向内的记号

(即从棒的边缘进入棒的彩色区域)

对于我正在使用的绘图和色标类型,最好将记号标记朝外

如何修改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()

只需为颜色栏设置
勾选参数

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()

可能存在的副本