Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Add the same trace to multiple subplots?

I am trying to add the same trace to two subplots so that when color is automatically rendered for the trace it is the same for both subplots by default. I have used fig.append() to add the same trace to each subplot, but the color is still different for the same trace in each subplot.

Essentially I am plotting the same data in two subplots - one is a zoomed in view. I do not want to manually have to match the colors (or put in color codes) between the two plots so the symbols are the same for each trace.


Hi @spencerchad,

It’s not possible for the same trace to reside in multiple subplots. Calling fig.append_trace essentially copies the input trace object to add to the figure, which is why you’re seeing multiple styles. So in order to have the traces appear identical you’ll need to specify the trace color/symbol properties before calling append_trace, this way plotly won’t apply it’s default color cycle.