subplots in plotly

Hi. I am trying to join 2 plots in R plotly using the subplot package but it ends up having separate legends for each plot. I have tried some manipulations to hide one legend and leave the other but the combined plot still carries 2 legends. Any pointers would be very much appreciated. Thank you!