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

R 3D multisurface how to add a legend

Hello,
I managed to plot multi surfaces in R with plotly, as explained in the tutorial https://plot.ly/r/3d-surface-plots/#multiple-surfaces

  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).
    Thanks!