Hide one Line in a Multi Line Plot

I have a line graph of stock returns. I also have a corresponding DataTable that displays the stocks.

I have been able to remove a line if its not selected from a figure by removing the data corresponding to that stock.

However I am unable to add that same data back.

Is there a way to hide one lines data, keeping the underlying data incase that stock is reselected and then have it reappear?

Well yes, if you are using the dcc.Graph all you have to do is click the name of the data you do not want to appear on the Legend, It will remove it from the set. The other way is to create a dropdown menu with a call back that will automatically update the plot when you remove the line in the selected stocks. Set the drop down to multi select, in fact look at Plotting multiple time series on one plot , and see how I did it

1 Like

Wow that was a lot simpler than I thought thanks