@@ -185,8 +185,8 @@ def _valid_plot_kwargs():
185185 'Description' : 'Axes Title (subplot title)' ,
186186 'Validator' : lambda value : isinstance (value ,(str ,dict )) },
187187
188- 'xlabel' : { 'Default' : 'Date' , # x-axis label
189- 'Description' : 'label for x-axis of main plot' ,
188+ 'xlabel' : { 'Default' : None , # x-axis label
189+ 'Description' : 'label for x-axis of plot' ,
190190 'Validator' : lambda value : isinstance (value ,str ) },
191191
192192 'ylabel' : { 'Default' : 'Price' , # y-axis label
@@ -653,10 +653,12 @@ def plot( data, **kwargs ):
653653
654654 xrotation = config ['xrotation' ]
655655 if not external_axes_mode :
656- _set_ticks_on_bottom_panel_only (panels ,formatter ,rotation = xrotation )
656+ _set_ticks_on_bottom_panel_only (panels ,formatter ,rotation = xrotation ,
657+ xlabel = config ['xlabel' ])
657658 else :
658659 axA1 .tick_params (axis = 'x' ,rotation = xrotation )
659660 axA1 .xaxis .set_major_formatter (formatter )
661+ axA1 .set_xlabel (config ['xlabel' ])
660662
661663 ysd = config ['yscale' ]
662664 if isinstance (ysd ,dict ):
@@ -705,7 +707,13 @@ def plot( data, **kwargs ):
705707 elif panid == 'lower' : panid = 1 # for backwards compatibility
706708 if apdict ['y_on_right' ] is not None :
707709 panels .at [panid ,'y_on_right' ] = apdict ['y_on_right' ]
708-
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 )
709717 aptype = apdict ['type' ]
710718 if aptype == 'ohlc' or aptype == 'candle' :
711719 ax = _addplot_collections (panid ,panels ,apdict ,xdates ,config )
@@ -783,7 +791,6 @@ def plot( data, **kwargs ):
783791 # working in `addplot`).
784792
785793 axA1 .set_ylabel (config ['ylabel' ])
786- axA1 .set_xlabel (config ['xlabel' ])
787794
788795 if config ['volume' ]:
789796 if external_axes_mode :
@@ -1250,6 +1257,10 @@ def _valid_addplot_kwargs():
12501257 'Description' : 'label for y-axis (for this addplot)' ,
12511258 'Validator' : lambda value : isinstance (value ,str ) },
12521259
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+
12531264 'ylim' : {'Default' : None ,
12541265 'Description' : 'Limits for addplot y-axis as tuple (min,max), i.e. (bottom,top)' ,
12551266 'Validator' : lambda value : isinstance (value , (list ,tuple )) and len (value ) == 2
0 commit comments