Shortcut for a dot on plots in matplotlib

So this is a question about a hosted solution. I tried to put some data labels on the dots in the matplotlib scatterplot that I have. I tried to imitate the solution here:

Is there a matplotlib equivalent of datacursormode matlab?

inside def __call__(self, event): I get a failure on the line:

 xdata, ydata = event.artist.get_data() AttributeError: 'CircleCollection' object has no attribute 'get_data' 

Looking at the docs here: http://matplotlib.sourceforge.net/api/artist_api.html#module-matplotlib.artist

I do not see the get_data () method for Artist. Is this something that is out of date or is something missing? If it was, does anyone know how else to get the equivalent call?

+3
python matplotlib
Jan 21 2018-12-21T00:
source share
1 answer

If you look at the rest of the code in __call__ , you will see that xdata and ydata never used. You can just delete the line

 xdata, ydata = event.artist.get_data() 

and the rest of Joe's beautiful code works great.

+3
Jan 21 '12 at 21:52
source share