How to delete a particular trace from multiple traces in a graph_objects figure?

Hi community,

How can I delete a particular trace from the figure? In fig.update_traces we can use the selector parameter to select the trace and modify it, however update_traces does not allow to delete the trace.

I found this thread where @empet suggested use of visible=False but my goal is to delete the trace completely and not just hide it as there will be multiple traces that can be added and removed in my Dash app.

Any help is appreciated, thanks!

Hi @dataturnsmeon, I just deleted the corresponding list items (traces) in the past. To find the traces I want to delete, I use the name argument of the traces. An example here:

2 Likes

Thank you @AIMPED !