@@ -148,7 +148,7 @@ def _valid_plot_kwargs():
148
148
'Validator' : lambda value : mcolors .is_color_like (value ) },
149
149
150
150
'title' : { 'Default' : None , # Figure Title
151
- 'Validator' : lambda value : isinstance (value ,str ) },
151
+ 'Validator' : lambda value : isinstance (value ,( str , dict ) ) },
152
152
153
153
'axtitle' : { 'Default' : None , # Axes Title (subplot title)
154
154
'Validator' : lambda value : isinstance (value ,str ) },
@@ -624,16 +624,28 @@ def plot( data, **kwargs ):
624
624
if external_axes_mode :
625
625
volumeAxes .tick_params (axis = 'x' ,rotation = xrotation )
626
626
volumeAxes .xaxis .set_major_formatter (formatter )
627
-
627
+
628
628
if config ['title' ] is not None :
629
629
if config ['tight_layout' ]:
630
630
# IMPORTANT: 0.89 is based on the top of the top panel
631
631
# being at 0.18+0.7 = 0.88. See _panels.py
632
632
# If the value changes there, then it needs to change here.
633
- fig . suptitle ( config [ 'title' ], size = 'x-large' ,weight = 'semibold' , va = 'bottom' , y = 0.89 )
633
+ title_kwargs = dict ( size = 'x-large' ,weight = 'semibold' , va = 'bottom' , y = 0.89 )
634
634
else :
635
- fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'center' )
636
-
635
+ title_kwargs = dict (size = 'x-large' ,weight = 'semibold' , va = 'center' )
636
+ if isinstance (config ['title' ],dict ):
637
+ title_dict = config ['title' ]
638
+ if 'title' not in title_dict :
639
+ raise ValueError ('Must have "title" entry in title dict' )
640
+ else :
641
+ title = title_dict ['title' ]
642
+ del title_dict ['title' ]
643
+ title_kwargs .update (title_dict ) # allows override default values set by mplfinance above
644
+ else :
645
+ title = config ['title' ] # config['title'] is a string
646
+ fig .suptitle (title ,** title_kwargs )
647
+
648
+
637
649
if config ['axtitle' ] is not None :
638
650
axA1 .set_title (config ['axtitle' ])
639
651
0 commit comments