1
我已经创建了一个彩条,其中有各种颜色。我已将其设置为选择事件。 当我点击颜色条上的特定颜色段时,我希望它返回颜色。 我厌倦了使用event.artist.get_facecolor()
,但它给我的错误'Axes' object has no attribute 'get_facecolor'
如何找到彩条的颜色matplotlib
我已经创建了一个彩条,其中有各种颜色。我已将其设置为选择事件。 当我点击颜色条上的特定颜色段时,我希望它返回颜色。 我厌倦了使用event.artist.get_facecolor()
,但它给我的错误'Axes' object has no attribute 'get_facecolor'
如何找到彩条的颜色matplotlib
抓斗(在onclick method on a colorbar matplotlib python等)的ydata
,并通过彩色图的运行它。
如果cb
是您的彩条对象
color = cb.cmap(cb.norm(event.mouseevent.ydata))
将返回与您单击的位置相关的RGBA颜色。
你和miik在同一个程序中吗?你们最近似乎在提出非常类似的问题。 – tacaswell 2013-02-20 03:57:06