Skip to content

Commit 648e13b

Browse files
Apply suggestions from code review
Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>
1 parent ea43177 commit 648e13b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

xarray/plot/plot.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,16 +651,14 @@ def newplotfunc(
651651
if subplot_kws is None:
652652
subplot_kws = dict()
653653

654-
if "surface" == plotfunc.__name__ and not kwargs.get("_is_facetgrid", False):
654+
if plotfunc.__name__ == "surface" and not kwargs.get("_is_facetgrid", False):
655655
# Check we have new enough version of matplotlib
656656
from distutils.version import LooseVersion
657657

658658
import matplotlib as mpl
659659

660660
if LooseVersion(mpl.__version__) < "3.2.0":
661661
raise ValueError("surface plot requires at least matplotlib-3.2.0")
662-
del LooseVersion
663-
del mpl
664662

665663
if ax is None:
666664
# Need to create a "3d" Axes instance for surface plots
@@ -683,7 +681,7 @@ def newplotfunc(
683681
plt = import_matplotlib_pyplot()
684682

685683
if (
686-
"surface" == plotfunc.__name__
684+
plotfunc.__name__ == "surface"
687685
and not kwargs.get("_is_facetgrid", False)
688686
and ax is not None
689687
):

xarray/tests/test_plot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def setup(self):
135135
# Remove all matplotlib figures
136136
plt.close("all")
137137

138-
def pass_in_axis(self, plotmethod, subplot_kw={}):
138+
def pass_in_axis(self, plotmethod, subplot_kw=None):
139+
subplot_kw = {} if subplot_kw is None else subplot_kw
139140
fig, axes = plt.subplots(ncols=2, subplot_kw=subplot_kw)
140141
plotmethod(ax=axes[0])
141142
assert axes[0].has_data()

0 commit comments

Comments
 (0)