@@ -291,21 +291,24 @@ def _make_margin_suptitles(fig, renderer, *, w_pad=0, h_pad=0):
291291
292292 if fig ._suptitle is not None and fig ._suptitle .get_in_layout ():
293293 p = fig ._suptitle .get_position ()
294- fig ._suptitle .set_position ((p [0 ], 1 - h_pad_local ))
295- bbox = inv_trans_fig (fig ._suptitle .get_tightbbox (renderer ))
296- fig ._layoutgrid .edit_margin_min ('top' , bbox .height + 2.0 * h_pad )
294+ if getattr (fig ._suptitle , '_autopos' , False ):
295+ fig ._suptitle .set_position ((p [0 ], 1 - h_pad_local ))
296+ bbox = inv_trans_fig (fig ._suptitle .get_tightbbox (renderer ))
297+ fig ._layoutgrid .edit_margin_min ('top' , bbox .height + 2 * h_pad )
297298
298299 if fig ._supxlabel is not None and fig ._supxlabel .get_in_layout ():
299300 p = fig ._supxlabel .get_position ()
300- fig ._supxlabel .set_position ((p [0 ], h_pad_local ))
301- bbox = inv_trans_fig (fig ._supxlabel .get_tightbbox (renderer ))
302- fig ._layoutgrid .edit_margin_min ('bottom' , bbox .height + 2.0 * h_pad )
301+ if getattr (fig ._supxlabel , '_autopos' , False ):
302+ fig ._supxlabel .set_position ((p [0 ], h_pad_local ))
303+ bbox = inv_trans_fig (fig ._supxlabel .get_tightbbox (renderer ))
304+ fig ._layoutgrid .edit_margin_min ('bottom' , bbox .height + 2 * h_pad )
303305
304306 if fig ._supylabel is not None and fig ._supxlabel .get_in_layout ():
305307 p = fig ._supylabel .get_position ()
306- fig ._supylabel .set_position ((w_pad_local , p [1 ]))
307- bbox = inv_trans_fig (fig ._supylabel .get_tightbbox (renderer ))
308- fig ._layoutgrid .edit_margin_min ('left' , bbox .width + 2.0 * w_pad )
308+ if getattr (fig ._supylabel , '_autopos' , False ):
309+ fig ._supylabel .set_position ((w_pad_local , p [1 ]))
310+ bbox = inv_trans_fig (fig ._supylabel .get_tightbbox (renderer ))
311+ fig ._layoutgrid .edit_margin_min ('left' , bbox .width + 2 * w_pad )
309312
310313
311314def _match_submerged_margins (fig ):
0 commit comments