@@ -731,6 +731,11 @@ def suptitle(self, t, *, x=.5, y=.98, **kwargs):
731
731
732
732
>>> fig.suptitle('This is the figure title', fontsize=12)
733
733
"""
734
+ manual_position = ('x' in kwargs or 'y' in kwargs )
735
+
736
+ x = kwargs .pop ('x' , 0.5 )
737
+ y = kwargs .pop ('y' , 0.98 )
738
+
734
739
if ('horizontalalignment' not in kwargs ) and ('ha' not in kwargs ):
735
740
kwargs ['horizontalalignment' ] = 'center'
736
741
if ('verticalalignment' not in kwargs ) and ('va' not in kwargs ):
@@ -751,17 +756,22 @@ def suptitle(self, t, *, x=.5, y=.98, **kwargs):
751
756
else :
752
757
self ._suptitle = sup
753
758
if self ._layoutbox is not None :
754
- figlb = self ._layoutbox
755
- self ._suptitle ._layoutbox = layoutbox .LayoutBox (
756
- parent = figlb ,
759
+ if not manual_position :
760
+ figlb = self ._layoutbox
761
+ self ._suptitle ._layoutbox = \
762
+ layoutbox .LayoutBox (parent = figlb ,
757
763
name = figlb .name + '.suptitle' )
758
- for child in figlb .children :
759
- if not (child == self ._suptitle ._layoutbox ):
760
- w_pad , h_pad , wspace , hspace = \
761
- self .get_constrained_layout_pads (
762
- relative = True )
763
- layoutbox .vstack ([self ._suptitle ._layoutbox , child ],
764
- padding = h_pad * 2. , strength = 'required' )
764
+ for child in figlb .children :
765
+ if not (child == self ._suptitle ._layoutbox ):
766
+ w_pad , h_pad , wspace , hspace = \
767
+ self .get_constrained_layout_pads (
768
+ relative = True )
769
+ layoutbox .vstack ([self ._suptitle ._layoutbox ,
770
+ child ],
771
+ padding = h_pad * 2. ,
772
+ strength = 'required' )
773
+ else :
774
+ self ._suptitle ._layoutbox = None
765
775
self .stale = True
766
776
return self ._suptitle
767
777
0 commit comments