@@ -148,10 +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 ) },
152
-
153
- 'title_lightweight' : { 'Default' : None , # Semibold or light title weight
154
- 'Validator' : lambda value : isinstance (value ,bool ) },
151
+ 'Validator' : lambda value : isinstance (value ,(str ,dict )) },
155
152
156
153
'axtitle' : { 'Default' : None , # Axes Title (subplot title)
157
154
'Validator' : lambda value : isinstance (value ,str ) },
@@ -627,21 +624,27 @@ def plot( data, **kwargs ):
627
624
if external_axes_mode :
628
625
volumeAxes .tick_params (axis = 'x' ,rotation = xrotation )
629
626
volumeAxes .xaxis .set_major_formatter (formatter )
630
-
627
+
631
628
if config ['title' ] is not None :
632
629
if config ['tight_layout' ]:
633
630
# IMPORTANT: 0.89 is based on the top of the top panel
634
631
# being at 0.18+0.7 = 0.88. See _panels.py
635
632
# If the value changes there, then it needs to change here.
636
- if config ['title_lightweight' ]:
637
- fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'light' , va = 'bottom' , y = 0.89 )
638
- else :
639
- 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 )
640
634
else :
641
- if config ['title_lightweight' ]:
642
- fig .suptitle (config ['title' ], size = 'x-large' ,weight = 'light' , va = 'center' )
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' )
643
640
else :
644
- fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'center' )
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
+
645
648
646
649
if config ['axtitle' ] is not None :
647
650
axA1 .set_title (config ['axtitle' ])
0 commit comments