Skip to content

Commit 06df10d

Browse files
implement y_on_right for addplot
1 parent 65c0c1f commit 06df10d

File tree

3 files changed

+810
-818
lines changed

3 files changed

+810
-818
lines changed

examples/scratch_pad/panels_ylim_width_alpha.ipynb

Lines changed: 0 additions & 817 deletions
This file was deleted.

examples/scratch_pad/panels_ylim_width_alpha_yside.ipynb

Lines changed: 803 additions & 0 deletions
Large diffs are not rendered by default.

src/mplfinance/plotting.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def plot( data, **kwargs ):
444444
lo = math.log(max(math.fabs(np.nanmin(lows)),1e-7),10) - 0.5
445445
hi = math.log(max(math.fabs(np.nanmax(highs)),1e-7),10) + 0.5
446446

447-
panels['mag'] = [None]*len(panels) # create 'mag' column
447+
panels['mag'] = [None]*len(panels) # create 'mag'nitude column
448448

449449
panels.at[config['main_panel'],'mag'] = {'lo':lo,'hi':hi} # update main panel magnitude range
450450

@@ -465,6 +465,9 @@ def plot( data, **kwargs ):
465465
if panid == 'main' : panid = 0 # for backwards compatibility
466466
elif panid == 'lower': panid = 1 # for backwards compatibility
467467

468+
if apdict['y_on_right'] is not None:
469+
panels.at[panid,'y_on_right'] = apdict['y_on_right']
470+
468471
#--------------------------------------------------------------#
469472
# Note: _auto_secondary_y() sets the 'magnitude' column in the
470473
# `panels` dataframe, which is needed for automatically
@@ -805,6 +808,9 @@ def _valid_addplot_kwargs():
805808

806809
'secondary_y' : { 'Default' : 'auto',
807810
'Validator' : lambda value: isinstance(value,bool) or value == 'auto' },
811+
812+
'y_on_right' : { 'Default' : None,
813+
'Validator' : lambda value: isinstance(value,bool) },
808814

809815
'ylabel' : { 'Default' : None,
810816
'Validator' : lambda value: isinstance(value,str) },

0 commit comments

Comments
 (0)