部分透明的散点图,但带有纯色条

在Python中,使用Matplotlib,如何简单地使用透明度(alpha< 1)进行散点图,但使用颜色条表示其颜色值,但alpha = 1? 这是一个人得到的,与
from pylab import *; scatter(range(10), arange(0, 100, 10), c=range(10), alpha=0.2); color_bar = colorbar()
: 彩条如何变得不透明? PS:我试过
color_bar.set_alpha(1); draw()
,但这没有做任何事......     
已邀请:
好吧,我找到了一种方法,看起来相对干净:(使用问题中的
ColorBar
对象)
color_bar.set_alpha(1)
color_bar.draw_all()
# pylab.draw() or pyplot.draw() might be necessary
不过要确认这是最有效的方法,这将是很棒的! :)     
这是一个巨大的,丑陋的黑客。但没有其他方法可行。也许其他人可以改进。
fig1 = pylab.figure()
fig2 = pylab.figure()
ax1 = fig1.add_subplot(111)
ax2 = fig2.add_subplot(111)
ax1.scatter(range(10), range(10), c=range(10), alpha=0.2)
im = ax2.scatter(range(10), range(10), c=range(10), alpha=1.0)
fig1.colorbar(im, ax=ax1)
fig1.show()
    

要回复问题请先登录注册