Set alpha of legend in ggplot/Plotly

Viewed 690

How do I get the legend in a plotly plot to not inherit the alpha values used in a plot?

I know how to do this with ggplot2: guides(colour = guide_legend(override.aes = list(alpha=1))) but this does not translate to plotly.

is there a similar option for plotly? When converting from ggplot to plotly it seems to pick up on the alpha value for the legend no matter what I do.

Example Code:

library(ggplot2)
library(plotly)

D <- rbind(beaver1,beaver2)
D$beaver= c(rep('A',nrow(beaver1)),rep('B',nrow(beaver2)))

p <- ggplot(D,aes(x=time,y=temp,color=beaver,group=day))+
  geom_point(alpha=.1,show.legend = F)+
  geom_line(alpha=.1,show.legend = F)+
  geom_smooth(se=F)

ggplotly(p)

The ggplot version:

ggplot version

The plotly version:

enter image description here

1 Answers
Related