Skip to content

Added xlabel= kwarg to mpf.plot() #564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 31, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/mplfinance/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def _valid_plot_kwargs():
'axtitle' : { 'Default' : None, # Axes Title (subplot title)
'Description' : 'Axes Title (subplot title)',
'Validator' : lambda value: isinstance(value,(str,dict)) },

'xlabel' : { 'Default' : 'Date', # x-axis label
'Description' : 'label for x-axis of main plot',
'Validator' : lambda value: isinstance(value,str) },

'ylabel' : { 'Default' : 'Price', # y-axis label
'Description' : 'label for y-axis of main plot',
Expand Down Expand Up @@ -779,6 +783,7 @@ def plot( data, **kwargs ):
# working in `addplot`).

axA1.set_ylabel(config['ylabel'])
axA1.set_xlabel(config['xlabel'])

if config['volume']:
if external_axes_mode:
Expand Down Expand Up @@ -1070,6 +1075,8 @@ def _addplot_columns(panid,panels,ydata,apdict,xdates,config):
def _addplot_apply_supplements(ax,apdict,xdates):
if (apdict['ylabel'] is not None):
ax.set_ylabel(apdict['ylabel'])
if (apdict['xlabel'] is not None):
ax.set_xlabel(apdict['xlabel'])
if apdict['ylim'] is not None:
ax.set_ylim(apdict['ylim'][0],apdict['ylim'][1])
if apdict['title'] is not None:
Expand Down