Open amstaniec opened 1 year ago
Hi @amstaniec. There's no way to change the marginal_x
trace order, but if you'd like the order to be consistent with the legend, you can reverse the legend explicitly with
fig.update_layout(legend_traceorder="reversed")
Then the right marginal looks backward (though that's less obvious, but I'd expect top->bottom to match left -> right) Another option is to flip the top marginal:
fig.update_layout(yaxis3_autorange='reversed')
@amstaniec I do see your point, it would be better if these matched the legend order. Even if you think of this trick you need to fiddle to figure out that it's yaxis3
, and if the base plot is faceted you'd need to find ALL the relevant y axes. @nicolaskruchten What do you think about flipping these axes by default? I guess it would apply to all marginal_x
plots except 'histogram'
?
This problem exists pretty much everywhere due to our mostly consistent inconsistent usage of origin-is-at-the-bottom/legend-reads-top-down so I'm hesitant to special-case just marginals: stacked bar charts, stacked areas, regular (non-marginal) horizontal box plots...
Ah yeah, much more widespread than I realized, and particularly stacking is tricky as you couldn't fix it just by flipping the relevant axis. OK so too big a change to be able to consider a bug but perhaps a mode we could opt into (with a large effort!)
Also in the official example: https://plotly.com/python/marginal-plots/
I think its confusing that the order of species (colors) is not the same in the marginal plots (above the main plot) and in the legend