這裏是我的嘗試:Matplotlib - 鼠標提示懸停
def onpick3(event):
ind = event.ind
print 'onpick3 scatter:'
fig.scatter(t, p, color='b', zorder=10, label='label', picker=True)
fig.legend(loc=fills_legend_pos[index])
fig.canvas.mpl_connect('pick_event', onpick3)
和錯誤
AttributeError: 'AxesSubplot' object has no attribute 'canvas'
編輯:無花果類型AxesSubplot的,並且被實例化這樣
fig = plt.subplot2grid((i, i), (j, 0), rowspan=1, colspan=i)
在我的散點圖上添加工具提示最簡單的方法是什麼?請注意,我想保留當前的框架,並調用fig.scatter,因爲這些散點圖覆蓋在現有的圖形上。
如何定義'fig'?儘管稱它爲'fig',它似乎是一個沒有'canvas'屬性的對象! – bernie