diff --git a/flopy/utils/gridintersect.py b/flopy/utils/gridintersect.py index 75c65205fc..6162798a53 100644 --- a/flopy/utils/gridintersect.py +++ b/flopy/utils/gridintersect.py @@ -1,4 +1,3 @@ -import matplotlib.pyplot as plt import numpy as np from .geometry import transform try: @@ -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: @@ -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() @@ -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()