如何使用 Plotly 控制顶部的跟踪图?如何使用、Plotly

2023-09-06 07:07:09 作者:l’étranger 局外人

我正在使用 Plotly python 库生成一个包含多个小提琴图和几个填充散点图的图形.无论我在代码中调用单独的 fig.add_trace 的顺序如何,小提琴图总是绘制在散点图后面.

I'm using the Plotly python library to generate a figure with several violin plots and several filled scatter plots. No matter what order I have the individual fig.add_trace calls in my code, the violin plots always plot behind the scatter plots.

有人知道是否有控制布局或绘图顺序的特定方法吗?zorder=3 之类的东西?

Does anyone know if there is a specific method for controlling layout or plot order? Something like zorder=3?

推荐答案

目前您可以通过对数据数组中的跟踪对象进行排序来控制跟踪类型内的跟踪顺序,但不能跨跟踪类型,因此小提琴总是落后分散.

At the moment you can control trace order within trace types by ordering the trace objects in the data array, but not across trace types, so violins will always draw behind scatters.