Black Lives Matter. Please consider donating to Black Girls Code today.

R 3D multisurface how to add a legend

I managed to plot multi surfaces in R with plotly, as explained in the tutorial

  1. Now I’d like to add a legend (like in 3D scatter).
  2. Cherry on the cake would be even a legend where you can click and unclick what you want to show on the plot.
    How can I do 1) and 2).