Skip to content

Commit

Permalink
redoing matplotlib deprecation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
afni-dglen committed Jul 18, 2024
1 parent d31ebbf commit 0ea6ac5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions peakdet/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,36 @@ def __init__(self, data):
delete = functools.partial(self.on_edit, method="delete")
reject = functools.partial(self.on_edit, method="reject")
insert = functools.partial(self.on_edit, method="insert")

# Check matplotlib version rectprops is deprecated with matplotlib 3.5.0 and then obsolete
if matplotlib.__version__ >= '3.5.0':
property_name = 'props'
else:
property_name = 'rectprops'

self.span2 = SpanSelector(
self.ax,
delete,
"horizontal",
button=1,
useblit=True,
rectprops=dict(facecolor="red", alpha=0.3),
**{property_name: dict(facecolor='red', alpha=0.3)},
)
self.span1 = SpanSelector(
self.ax,
reject,
"horizontal",
button=2,
useblit=True,
rectprops=dict(facecolor="blue", alpha=0.3),
**{property_name: dict(facecolor='blue', alpha=0.3)},
)
self.span3 = SpanSelector(
self.ax,
insert,
"horizontal",
button=3,
useblit=True,
rectprops=dict(facecolor="green", alpha=0.3),
**{property_name: dict(facecolor='green', alpha=0.3)},
)

self.plot_signals(False)
Expand Down

0 comments on commit 0ea6ac5

Please sign in to comment.