python - Matplotlib - tooltips on mouse hover -
here tried:
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)
and error
attributeerror: 'axessubplot' object has no attribute 'canvas'
edit: fig of type axessubplot, , instantiated this
fig = plt.subplot2grid((i, i), (j, 0), rowspan=1, colspan=i)
what easiest way add together tooltips on scatterplot? please note want maintain current framework, calling fig.scatter, these scatters overlaid on existing figure.
subplot2grid()
returns axes
object, utilize it's figure
attribute figure object:
import pylab pl axes = pl.subplot2grid((2, 2), (0, 0), rowspan=1, colspan=1) axes.figure.canvas.mpl_connect('pick_event', onpick3)
python matplotlib tooltip
No comments:
Post a Comment