Skip to content

Commit 1685252

Browse files
committed
Added lightweight title option
1 parent 278e4b4 commit 1685252

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/mplfinance/plotting.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ def _valid_plot_kwargs():
149149

150150
'title' : { 'Default' : None, # Figure Title
151151
'Validator' : lambda value: isinstance(value,str) },
152+
153+
'title_lightweight' : { 'Default' : None, # Semibold or light title weight
154+
'Validator' : lambda value: isinstance(value,bool) },
152155

153156
'axtitle' : { 'Default' : None, # Axes Title (subplot title)
154157
'Validator' : lambda value: isinstance(value,str) },
@@ -630,10 +633,16 @@ def plot( data, **kwargs ):
630633
# IMPORTANT: 0.89 is based on the top of the top panel
631634
# being at 0.18+0.7 = 0.88. See _panels.py
632635
# 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)
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)
634640
else:
635-
fig.suptitle(config['title'],size='x-large',weight='semibold', va='center')
636-
641+
if config['title_lightweight']:
642+
fig.suptitle(config['title'], size='x-large',weight='light', va='center')
643+
else:
644+
fig.suptitle(config['title'],size='x-large',weight='semibold', va='center')
645+
637646
if config['axtitle'] is not None:
638647
axA1.set_title(config['axtitle'])
639648

0 commit comments

Comments
 (0)