Skip to content

Commit

Permalink
fix(gridintersect): removed matplotlib dependency (#643)
Browse files Browse the repository at this point in the history
A recent PR added an import of gridintersect when flopy is imported.  This broke some things on the MODFLOW 6 development side and inadvertently required matplotlib, even if no plotting is needed.
  • Loading branch information
langevin-usgs authored Sep 9, 2019
1 parent 32309e2 commit c7bb2c2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion flopy/utils/gridintersect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import matplotlib.pyplot as plt
import numpy as np
from .geometry import transform
try:
Expand Down Expand Up @@ -1055,6 +1054,10 @@ def plot_polygon(rec, ax=None, **kwargs):
returns the axes handle
"""
try:
import matplotlib.pyplot as plt
except ImportError:
print('This feature requires matplotlib.')
try:
from descartes import PolygonPatch
except ModuleNotFoundError:
Expand Down Expand Up @@ -1093,6 +1096,10 @@ def plot_linestring(rec, ax=None, **kwargs):
returns the axes handle
"""
try:
import matplotlib.pyplot as plt
except ImportError:
print('This feature requires matplotlib.')
if ax is None:
_, ax = plt.subplots()

Expand Down Expand Up @@ -1130,6 +1137,10 @@ def plot_point(rec, ax=None, **kwargs):
returns the axes handle
"""
try:
import matplotlib.pyplot as plt
except ImportError:
print('This feature requires matplotlib.')
if ax is None:
_, ax = plt.subplots()

Expand Down

0 comments on commit c7bb2c2

Please sign in to comment.