Skip to content

Commit 5a41f5c

Browse files
committed
fix mpl version comparisons
1 parent 0a5b89e commit 5a41f5c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

flopy/export/utils.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Union
55

66
import numpy as np
7+
from packaging.version import Version
78

89
from ..datbase import DataInterface, DataListInterface, DataType
910
from ..mbase import BaseModel, ModelInterface
@@ -1726,12 +1727,12 @@ def export_contours(
17261727
# (possibly disconnected) components. Before
17271728
# 3.8, iterating over ContourSet.collections
17281729
# and enumerating from get_paths() suffices,
1729-
# but post-3.8 we have to walk the segmments
1730+
# but post-3.8, we have to walk the segments
17301731
# to distinguish disconnected components.
1731-
mpl_ver = version("matplotlib")
1732+
mpl_ver = Version(version("matplotlib"))
17321733

17331734
for ctr in contours:
1734-
if mpl_ver < "3.8.0":
1735+
if mpl_ver < Version("3.8.0"):
17351736
levels = ctr.levels
17361737
for i, c in enumerate(ctr.collections):
17371738
paths = c.get_paths()
@@ -1831,12 +1832,12 @@ def export_contourf(
18311832
# (possibly disconnected) components. Before
18321833
# 3.8, iterating over ContourSet.collections
18331834
# and enumerating from get_paths() suffices,
1834-
# but post-3.8 we have to walk the segmments
1835+
# but post-3.8, we have to walk the segments
18351836
# to distinguish disconnected components.
1836-
mpl_ver = version("matplotlib")
1837+
mpl_ver = Version(version("matplotlib"))
18371838

18381839
for ctr in contours:
1839-
if mpl_ver < "3.8.0":
1840+
if mpl_ver < Version("3.8.0"):
18401841
levels = ctr.levels
18411842
for idx, col in enumerate(ctr.collections):
18421843
for contour_path in col.get_paths():

0 commit comments

Comments
 (0)