mplfinance
mplfinance copied to clipboard
zorder of plots (scatter - line) added with addplot
Is there a way to manage the order (z axis) of the graphs added with addplot? Currently I would like to display my scatter on top of my line, but no matter what order I pass them in addplot the line appears on top. With matplotlib there is zorder which manages this.
Here is a small exemple of code for which the line_plot appears over the scatter_plot:
scatter_plot = mpf.make_addplot(scatter_data, type='scatter')
line_plot = mpf.make_addplot(line_data, type='line')
mpf.plot(candle_data, type='candle', addplot=[scatter_plot, line_plot])
Thank you very much!
Jessica,
Good point! I think we should add a zorder
kwarg to both mpf.plot()
(for the candles, etc.) and mpf.make_addplot()
.
Candles may be tricky because they are made up of both line collections and patch colletions which by default have different zorders; however adding zorder to make_addplot()
should be relatively trivial. Are you interested in making the change?
Thanks. --Daniel
I did a little playing around with the code. Even the candlesticks will be easy to set the zorder
.
Hi, is there any solution for that? i have the same problem, can REALLY use zOrder in my subplots
@Omri93h
Omri,
I am hoping to have time to implement a zorder
kwarg for plot()
and for make_addplot()
sometime in the next 6 to 8 weeks. If you would like to contribute this enhancement to mplfinance, I would be happy to guide you through the process; just let me know.
All the best. --Daniel