Black Lives Matter. Please consider donating to Black Girls Code today.

Does z-order exist?

I can’t figure out a way to change the z-order of traces in my plots. I’m trying to put a stacked area plot (Scatter()) under some bars (Bar()), but the areas are always on top of the bars, no matter what order I add them to the figure.

I’ve even tried creating the figure using matplotlib, which does have the concept of zorder, and converting it, but mpl_to_plotly() seems to ignore it…


I don’t believe there’s an easy way to do this. While you can change the draw order of traces which are on the same Y axis by changing their position in the trace array, I think that the traces on top of a second y axis are always going to be drawn on top of those on the first. Being able to attache a z-axis to a trace would be a really nice addition. :slight_smile:

Do you know how to change trace positions in the trace array?