3

So this is sort of a question about a posted solution. I was trying to put some data labels on points in a matplotlib scatterplot I have. I was trying to imitate the solution here:

Is there a matplotlib equivalent of MATLAB's datacursormode?

within def __call__(self, event): I get a failure at line:

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

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

I see no method get_data() for Artist. Is this just something that has been deprecated or did I miss something? If it has been, anyone know of how else to get an equivalent call?

Zephyr
  • 11,891
  • 53
  • 45
  • 80
user926914
  • 193
  • 1
  • 15

1 Answers1

3

If you look at the rest of the code in __call__ you'll see xdata and ydata are never used. You can simply delete the line

xdata, ydata = event.artist.get_data()

and the rest of Joe's beautiful code works just fine.

unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677