I am making a ggplotly plot that defines groups with different fill colors (group A or Group B).
library(ggplot2)
library(plotly)
data <- data.frame(x = c(1,2,3, 10, 11, 12),
y = c(1,2,3, 10, 11, 12),
group = c(rep("A",3), rep("B",3)))
p <- ggplot(data, aes(x = x, y = y, fill = group))+
geom_point()
ggplotly(p)
I want one of the levels to not show by default, as if I clicked the legend to hide the level.
How can I programmatically set the legend so the B group is deselected by default.