@@ -233,14 +233,17 @@ def update(self, **kwargs):
233233 if not isinstance (ax , SubplotBase ):
234234 # Check if sharing a subplots axis
235235 if ax ._sharex is not None and isinstance (ax ._sharex , SubplotBase ):
236- ax ._sharex .update_params ()
237- ax .set_position (ax ._sharex .figbox )
236+ if ax ._sharex .get_subplotspec ().get_gridspec () == self :
237+ ax ._sharex .update_params ()
238+ ax .set_position (ax ._sharex .figbox )
238239 elif ax ._sharey is not None and isinstance (ax ._sharey ,SubplotBase ):
239- ax ._sharey .update_params ()
240- ax .set_position (ax ._sharey .figbox )
240+ if ax ._sharey .get_subplotspec ().get_gridspec () == self :
241+ ax ._sharey .update_params ()
242+ ax .set_position (ax ._sharey .figbox )
241243 else :
242- ax .update_params ()
243- ax .set_position (ax .figbox )
244+ if ax .get_subplotspec ().get_gridspec () == self :
245+ ax .update_params ()
246+ ax .set_position (ax .figbox )
244247
245248
246249
@@ -287,7 +290,7 @@ def tight_layout(self, fig, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect
287290 subplot_list = []
288291 num1num2_list = []
289292 subplot_dict = {}
290-
293+
291294 for ax in fig .axes :
292295 locator = ax .get_axes_locator ()
293296 if hasattr (locator , "get_subplotspec" ):
@@ -340,7 +343,7 @@ def tight_layout(self, fig, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect
340343 pad = pad , h_pad = h_pad , w_pad = w_pad ,
341344 rect = (left , bottom , right , top ))
342345
343-
346+
344347 self .update (** kwargs )
345348
346349
0 commit comments