您只需要了解如何访问这些行,就可以尝试:>>> CB.ax.get_children()
[, , , , , , , , , , ]
好吧,猜猜看,我敢打赌第五项是分隔线列表。我们正在寻找一些.line对象,有两个。第一个(第三个)实际上是整个颜色条的边缘(如果我没记错的话)。所以我将寻找下一个.line对象。
现在让我们试着用几种方法修改它:>>> len(lines1[4].get_linewidths())
11 #how many item are there? 11 lines
>>> lines1[4].set_color(['r']*11) #set them all to red, in this example we actually want to have the color stay the same, this is just for a demonstration.
>>> lines1[4].set_linewidths([2]*11) #set them all to have linewidth of 2.
结果