Skip to content

Commit 5f039a8

Browse files
no addplot xlabel support; bump vers; example
1 parent 67e3388 commit 5f039a8

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

examples/plot_customizations.ipynb

Lines changed: 12 additions & 11 deletions
Large diffs are not rendered by default.

src/mplfinance/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version_info = (0, 12, 9, 'beta', 2)
1+
version_info = (0, 12, 9, 'beta', 3)
22

33
_specifier_ = {'alpha': 'a','beta': 'b','candidate': 'rc','final': ''}
44

src/mplfinance/plotting.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -707,13 +707,6 @@ def plot( data, **kwargs ):
707707
elif panid == 'lower': panid = 1 # for backwards compatibility
708708
if apdict['y_on_right'] is not None:
709709
panels.at[panid,'y_on_right'] = apdict['y_on_right']
710-
if apdict['xlabel'] is not None:
711-
apdict['xlabel'] = None # set to None so `_addplot_apply_supplements()` won't apply it.
712-
warnings.warn('\n\n ================================================================= '+
713-
'\n\n WARNING: make_addplot `xlabel` IGNORED in Panels mode.'+
714-
'\n Use `mpf.plot(...,xlabel=)` instead.'+
715-
'\n\n ================================================================ ',
716-
category=UserWarning)
717710
aptype = apdict['type']
718711
if aptype == 'ohlc' or aptype == 'candle':
719712
ax = _addplot_collections(panid,panels,apdict,xdates,config)
@@ -1082,8 +1075,11 @@ def _addplot_columns(panid,panels,ydata,apdict,xdates,config):
10821075
def _addplot_apply_supplements(ax,apdict,xdates):
10831076
if (apdict['ylabel'] is not None):
10841077
ax.set_ylabel(apdict['ylabel'])
1085-
if (apdict['xlabel'] is not None):
1086-
ax.set_xlabel(apdict['xlabel'])
1078+
# Note that xlabel is NOT supported for addplot. This is because
1079+
# in Panels Mode, there is only one xlabel (on the bottom axes)
1080+
# which is handled by the `xlabel` kwarg of `mpf.plot()`,
1081+
# whereas in External Axes Mode, users can call `Axes.set_xlabel()` on
1082+
# the axes object of their choice.
10871083
if apdict['ylim'] is not None:
10881084
ax.set_ylim(apdict['ylim'][0],apdict['ylim'][1])
10891085
if apdict['title'] is not None:
@@ -1257,10 +1253,6 @@ def _valid_addplot_kwargs():
12571253
'Description' : 'label for y-axis (for this addplot)',
12581254
'Validator' : lambda value: isinstance(value,str) },
12591255

1260-
'xlabel' : { 'Default' : None, # x-axis label
1261-
'Description' : 'x-axis label (for addplot ONLY when in external axes mode)',
1262-
'Validator' : lambda value: isinstance(value,str) },
1263-
12641256
'ylim' : {'Default' : None,
12651257
'Description' : 'Limits for addplot y-axis as tuple (min,max), i.e. (bottom,top)',
12661258
'Validator' : lambda value: isinstance(value, (list,tuple)) and len(value) == 2

0 commit comments

Comments
 (0)