@@ -155,8 +155,7 @@ def plot(
155
155
Relative tolerance used to determine if the indexes
156
156
are uniformly spaced. Usually a small positive number.
157
157
subplot_kws : dict, optional
158
- Dictionary of keyword arguments for matplotlib subplots. Only applies
159
- to FacetGrid plotting.
158
+ Dictionary of keyword arguments for matplotlib subplots.
160
159
**kwargs : optional
161
160
Additional keyword arguments to matplotlib
162
161
@@ -177,10 +176,10 @@ def plot(
177
176
178
177
if ndims in [1 , 2 ]:
179
178
if row or col :
179
+ kwargs ["subplot_kws" ] = subplot_kws
180
180
kwargs ["row" ] = row
181
181
kwargs ["col" ] = col
182
182
kwargs ["col_wrap" ] = col_wrap
183
- kwargs ["subplot_kws" ] = subplot_kws
184
183
if ndims == 1 :
185
184
plotfunc = line
186
185
kwargs ["hue" ] = hue
@@ -190,6 +189,7 @@ def plot(
190
189
kwargs ["hue" ] = hue
191
190
else :
192
191
plotfunc = pcolormesh
192
+ kwargs ["subplot_kws" ] = subplot_kws
193
193
else :
194
194
if row or col or hue :
195
195
raise ValueError (error_msg )
@@ -553,8 +553,8 @@ def _plot2d(plotfunc):
553
553
always infer intervals, unless the mesh is irregular and plotted on
554
554
a map projection.
555
555
subplot_kws : dict, optional
556
- Dictionary of keyword arguments for matplotlib subplots. Only applies
557
- to FacetGrid plotting .
556
+ Dictionary of keyword arguments for matplotlib subplots. Only used
557
+ for 2D and FacetGrid plots .
558
558
cbar_ax : matplotlib Axes, optional
559
559
Axes in which to draw the colorbar.
560
560
cbar_kwargs : dict, optional
@@ -724,7 +724,10 @@ def newplotfunc(
724
724
"plt.imshow's `aspect` kwarg is not available " "in xarray"
725
725
)
726
726
727
- ax = get_axis (figsize , size , aspect , ax )
727
+ if subplot_kws is None :
728
+ subplot_kws = dict ()
729
+ ax = get_axis (figsize , size , aspect , ax , ** subplot_kws )
730
+
728
731
primitive = plotfunc (
729
732
xplt ,
730
733
yplt ,
0 commit comments