Good morning!
So it is the first time I have seriously played with the Plotly library and would love to use it further in projects. I have been working with Plotly 4.5.6.900 in R 3.3.2 trying to get legends to work together as one. Currently I’m using the following to generate this image.
a <- plot_ly(data = oneDeal6, type="bar", x = ~ClosedYearQuarter, y = ~Turns, color = ~Family, colors = "GnBu", hoverinfo = 'text',
text = ~paste(Family,"\nTurns: ", round(Turns,2)))
b <- plot_ly(data = oneDeal6, type="bar", x = ~ClosedYearQuarter, y = ~GP, color = ~Family, colors = "GnBu", hoverinfo = 'text',
text = ~paste(Family,"\nGP: ", percent(GP)))
c <- plot_ly(data = oneDeal6, type="bar", x = ~ClosedYearQuarter, y = ~AvgDiscount, color = ~Family, colors = "GnBu",hoverinfo = 'text',
text = ~paste(Family,"\nAvg Discount: ", percent(AvgDiscount)))
d <- subplot(a,b,c,nrows = 3, shareX =TRUE, shareY = TRUE)
As you can see it generates three separate instances of the legend that are not connected. So if I try to double click on any of the types it only highlights the bars from the legend that is residing to the graph as shown in the following image.
Is there any way that I can connect / group the three plots to one legend so that they work together as one? I know that it can be done because when I do the same thing with the ggplotly function it will do this as shown in the preceding image.
Thank you for any help or tips that can be provided.