Mplfinance: Is there a way to set the value range for the Y axis?

Created on 14 Jun 2020  路  3Comments  路  Source: matplotlib/mplfinance

Thank you for this great library and features.

I'd like to be able to explicitly set the min/max values of the Y axis, in the main plot and in sub-plots.
For example, say that the price range is from 50-60 for a given period. I'd like to set the Y axis to be from 0 to 100, or 0 to 200.

Similarly, for subplots/panels - say that I plot an indicator (e.g. RSI) - and say that the value of the RSI is between 40-50 for a given period. I'd like to set the Y axis to be 0 to 100, instead of auto-scaling of the Y axis.

Is there a way to do that?

Again - thank you for this!!

enhancement question released

Most helpful comment

pip install --upgrade mplfinance

set_ylim=(ymin,ymax) has been changed to just ylim=(ymin,ymax)
this change was to make the kwarg name consistent with other kwargs names, such as ylabel.

furthermore, kwarg ylim=(ymin,ymax) is now available in both mpf.plot() and mpf.make_addplot()

All 3 comments

Usae kwarg set_ylim=(ymin,ymax) in your call to plot, for example:

mpf.plot(data,...,set_ylim=(0,100))

Unfortunately the kwarg is not yet available in make_addplot() (and thus will only affect the main panel). I hope to make it available in make_addplot() soon (within a couple weeks or so).

Thank you very much. I wasn't aware of the set_ylim. Makes sense and I'm looking forward to seeing it working in make_addplot() as well.

Also, "hlines" would be very useful in make_addplot() as well (though I was able to work around it for now by explicitly building the fixed-value DataFrame).

Finally - please note that we're building a whole platform around this work, so again, thank you, and if you need to run anything by the team here, feel free to reach out and do so. Thank you for the great work!!

pip install --upgrade mplfinance

set_ylim=(ymin,ymax) has been changed to just ylim=(ymin,ymax)
this change was to make the kwarg name consistent with other kwargs names, such as ylabel.

furthermore, kwarg ylim=(ymin,ymax) is now available in both mpf.plot() and mpf.make_addplot()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonholzapfel picture simonholzapfel  路  5Comments

ismailbayram picture ismailbayram  路  4Comments

kitt-th picture kitt-th  路  5Comments

viorell91 picture viorell91  路  3Comments

franklee00 picture franklee00  路  4Comments