【发布时间】:2011-10-31 15:09:50
【问题描述】:
在以下最小示例中,我创建了 1 点散点图,然后使用 Collection.set_color 更改循环中点的颜色。如果我在第一次调用 scatter 时设置颜色,set_color 将不会改变它的面颜色(只有边缘颜色),而如果我在创建散点图时没有指定它,面颜色会改变根据set_color.
from pylab import *
from numpy import *
coll=scatter([0],[0],s=500,c=[.1]) # omit c=[.1] here to have face color changing later
ion(); show()
for a in linspace(.1,.9):
coll.set_color(coll.get_cmap()(a))
draw()
这是一个错误,还是我在文档中遗漏了什么?
【问题讨论】:
-
是的,在 win 7 64bit 中复制,mpl 1.0.1
-
在这里按预期工作。 Win7 32bit, mpl 1.1.0.
-
我在 matplotlib 上遇到过类似的问题——就像一个散点只能被分配一次颜色并且永远不会被覆盖。
标签: python matplotlib