mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

One Y axis on panel with multiple studies?

Open muraaby opened this issue 3 years ago • 3 comments

I am having trouble specifying one y axis for all studies on my sub panels. Is there a way to remove either the left or right y axis and fixing them to one?

I tried to add a 0 line to my studies, as you can see the line starts at 0 on the left and ends slightly above zero on the right, it makes it hard to visually see when the 0 line is crossed and if it was correctly crossed.

Example

I apologize if if I am out of the contributing guidelines, my internet is dismal at the moment and haven't been able to load the guidelines.

muraaby avatar Jan 16 '22 15:01 muraaby

This is not related to the number of studies, but rather to the relative magnitude of the studies in relation to each other.

This is documented in the addplot tutorial between cells In [15] and In [16]. To quote:


Plotting additional data with a secondary y-axis

  • mpf.make_addplot() has a keyword argument called secondary_y which can have three possible values:
    • True,
    • False, and
    • 'auto'
  • The default value is 'auto' which means if you don't specify secondary_y, or if you specify secondary_y='auto', then mpf.plot() will attempt to decide whether a secondary y-axis is needed, by comparing the order of magnitude of the addplot data with the order of magnitude of the data that is already on the plot.
  • If mpf.plot() gets it wrong, you can always override by setting secondary_y=True or secondary_y=False.

DanielGoldfarb avatar Jan 16 '22 16:01 DanielGoldfarb

I just noticed that my browser double posted this question. I would remove one if I could.

muraaby avatar Jan 16 '22 16:01 muraaby

Thank you so much Daniel.

muraaby avatar Jan 16 '22 16:01 muraaby