Remove all traces

Hi @KidSampson, glad you’re enjoying the library!

You can remove all traces for a FigureWidget by assigning an empty list the the data property

fig.data = []

You can also remove only select traces by assigning the data property to a subset of itself. So to remove the second trace, but keep the first and third trace:

fig.data = [fig.data[0], fig.data[2]]

If you need to clear the layout as well, assign an emtpy dict to the layout property

fig.layout = {}

Hope that helps!
-Jon

9 Likes