Skip to content

Commit

Permalink
fix mpl version comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Sep 19, 2023
1 parent 0a5b89e commit 5c23b57
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions flopy/export/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Union

import numpy as np
from packaging import Version

from ..datbase import DataInterface, DataListInterface, DataType
from ..mbase import BaseModel, ModelInterface
Expand Down Expand Up @@ -1726,12 +1727,12 @@ def export_contours(
# (possibly disconnected) components. Before
# 3.8, iterating over ContourSet.collections
# and enumerating from get_paths() suffices,
# but post-3.8 we have to walk the segmments
# but post-3.8, we have to walk the segments
# to distinguish disconnected components.
mpl_ver = version("matplotlib")
mpl_ver = Version(version("matplotlib"))

for ctr in contours:
if mpl_ver < "3.8.0":
if mpl_ver < Version("3.8.0"):
levels = ctr.levels
for i, c in enumerate(ctr.collections):
paths = c.get_paths()
Expand Down Expand Up @@ -1831,12 +1832,12 @@ def export_contourf(
# (possibly disconnected) components. Before
# 3.8, iterating over ContourSet.collections
# and enumerating from get_paths() suffices,
# but post-3.8 we have to walk the segmments
# but post-3.8, we have to walk the segments
# to distinguish disconnected components.
mpl_ver = version("matplotlib")
mpl_ver = Version(version("matplotlib"))

for ctr in contours:
if mpl_ver < "3.8.0":
if mpl_ver < Version("3.8.0"):
levels = ctr.levels
for idx, col in enumerate(ctr.collections):
for contour_path in col.get_paths():
Expand Down

0 comments on commit 5c23b57

Please sign in to comment.