joferkington / mpldatacursor

Interactive "data cursors" (a.k.a. annotation pop-ups) for matplotlib
MIT License
194 stars 47 forks source link

Getting error messages while trying to use the module, even with the basic example. #90

Closed panjoel4 closed 4 years ago

panjoel4 commented 5 years ago

Hi joe,

I am new at programming, I am trying to use this module to highlight my well log result from petropy. But I couldn't get this module work properly, not even with the basic example below.

import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor

data = np.outer(range(10), range(1, 5))

plt.plot(data)
plt.title('Click somewhere on a line')

datacursor(hover = True)

plt.show()

here is the error message given while moving my mouse over the line:

Traceback (most recent call last):
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\cbook\__init__.py", line 216, in process
    func(*args, **kwargs)
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 657, in _select
    self(new_event)
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 272, in __call__
    self._show_annotation_box(event)
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 312, in _show_annotation_box
    self.update(event, annotation)
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 560, in update
    annotation.set_text(self.formatter(**info))
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 382, in _formatter
    x = self._format_coord(x, ax.get_xlim())
  File "C:\Users\Henky\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mpldatacursor\datacursor.py", line 424, in _format_coord
    formatter._set_format(*limits)
TypeError: _set_format() takes 1 positional argument but 3 were given

Thanks joe,

joferkington commented 5 years ago

Looks like there were some recent changes in the latest version of maplotlib. I'll have a fix for this shortly. Thanks for the report!

sammerpuran commented 4 years ago

I still face this issue, has there been any update on that?

matthijsfh commented 4 years ago

Any fix yet? This bug is really nasty.

Thanks. matthijs

joferkington commented 4 years ago

This is fixed in 617a25b Updating from master will fix the issue right now, but I'll have a new release out shortly, and then the usual pip install/etc will work as well.

Thanks again for the report!