joferkington / mpldatacursor

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

_set_format() error when using datacursor() #91

Closed epeters13 closed 4 years ago

epeters13 commented 5 years ago

I get the following error when following the basic example:

`In [1]: plot(arange(10))
Out[1]: [<matplotlib.lines.Line2D at 0x7f56570df278>]

In [2]: import mpldatacursor

In [3]: mpldatacursor.datacursor()
/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/convenience.py:160: MatplotlibDeprecationWarning: The iterable function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use np.iterable instead. if not cbook.iterable(axes): /home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py:147: MatplotlibDeprecationWarning: The iterable function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use np.iterable instead. if not cbook.iterable(artists): Out[3]: <mpldatacursor.datacursor.DataCursor at 0x7f5666105b38>

Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/matplotlib/cbook/init.py", line 216, in process func(*args, kwargs) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 709, in _select self(new_event) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 235, in call self._show_annotation_box(event) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 275, in _show_annotation_box self.update(event, annotation) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 566, in update annotation.set_text(self.formatter(info)) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 348, in _formatter x = self._format_coord(x, limits) File "/home/epeters/src/python_lib/mpldatacursor/mpldatacursor/datacursor.py", line 402, in _format_coord formatter._set_format(limits) TypeError: _set_format() takes 1 positional argument but 2 were given In [4]: from matplotlib.ticker import ScalarFormatter `

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

Was there a fix for that? I am still facing this issue...

joferkington commented 4 years ago

My apologies for the delay -- Life and work have been rather hectic and I abandoned my side projects for awhile.

This is fixed in https://github.com/joferkington/mpldatacursor/commit/617a25bd664e83968dc11eaed103fe2558864de5 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.

joferkington commented 4 years ago

Thanks again for the report!