Skip to content

Commit

Permalink
imports and version comparison fixes2
Browse files Browse the repository at this point in the history
  • Loading branch information
afni-dglen committed Jul 19, 2024
1 parent 7b80a0d commit a54d327
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions peakdet/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

import functools

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from loguru import logger
from matplotlib.widgets import SpanSelector
from packaging.version import Version

from peakdet import operations, utils

Expand Down Expand Up @@ -61,35 +63,35 @@ def __init__(self, data):
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'
# Check matplotlib version rectprops is deprecated with matplotlib 3.5.0 and then obsolete
if Version(matplotlib.__version__) >= Version("3.5.0"):
property_name = "props"
else:
property_name = 'rectprops'
property_name = "rectprops"

self.span2 = SpanSelector(
self.ax,
delete,
"horizontal",
button=1,
useblit=True,
**{property_name: 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,
**{property_name: 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,
**{property_name: dict(facecolor='green', alpha=0.3)},
**{property_name: dict(facecolor="green", alpha=0.3)},
)

self.plot_signals(False)
Expand Down

0 comments on commit a54d327

Please sign in to comment.