Skip to content

Commit

Permalink
tplot/frame.py: fixes for Matplotlib 3.3+ (#1191)
Browse files Browse the repository at this point in the history
* tplot/frame.py: fix for Matplotlib 3.3+

Reason: The iterable function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use np.iterable instead.

Inspired by stonebig/plotnine@2044a91

* fix set_picker deprecation warning

* remove unused cbook import

* fixes for Matplotlib 3.3+
  • Loading branch information
neteler committed Dec 21, 2020
1 parent b85086e commit e926027
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions gui/wxpython/timeline/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
FigureCanvasWxAgg as FigCanvas, \
NavigationToolbar2WxAgg as NavigationToolbar
import matplotlib.dates as mdates
from matplotlib import cbook
except ImportError as e:
raise ImportError(_('The Timeline Tool needs the "matplotlib" '
'(python-matplotlib and on some systems also python-matplotlib-wx) package(s) to be installed. {0}').format(e))
Expand Down Expand Up @@ -615,7 +614,7 @@ def __init__(
self.formatFunction = formatFunction
self.offsets = offsets
self.display_all = display_all
if not cbook.iterable(artists):
if not np.iterable(artists):
artists = [artists]
self.artists = artists

Expand All @@ -626,7 +625,7 @@ def __init__(
for ax in self.axes:
self.annotations[ax] = self.annotate(ax)
for artist in self.artists:
artist.set_picker(tolerance)
artist.set_pickradius(tolerance)
for fig in self.figures:
fig.canvas.mpl_connect('pick_event', self)
fig.canvas.mpl_connect('key_press_event', self.keyPressed)
Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/tplot/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
FigureCanvasWxAgg as FigCanvas, \
NavigationToolbar2WxAgg as NavigationToolbar
import matplotlib.dates as mdates
from matplotlib import cbook
except ImportError as e:
raise ImportError(_('The Temporal Plot Tool needs the "matplotlib" '
'(python-matplotlib) package to be installed. {0}').format(e))
Expand Down Expand Up @@ -1125,7 +1124,7 @@ def __init__(self, artists, lookUp, formatFunction, convert,
self.formatFunction = formatFunction
self.offsets = offsets
self.display_all = display_all
if not cbook.iterable(artists):
if not np.iterable(artists):
artists = [artists]
self.artists = artists
self.convert = convert
Expand All @@ -1136,7 +1135,7 @@ def __init__(self, artists, lookUp, formatFunction, convert,
for ax in self.axes:
self.annotations[ax] = self.annotate(ax)
for artist in self.artists:
artist.set_picker(tolerance)
artist.set_pickradius(tolerance)
for fig in self.figures:
fig.canvas.mpl_connect('pick_event', self)
fig.canvas.mpl_connect('key_press_event', self.keyPressed)
Expand Down

0 comments on commit e926027

Please sign in to comment.