Hi! I am attempting to convert the ggplot produced by the following code into a plotly plot.
plot1 <- ggplot(fdata, aes_string(x = paste(xvar), y = 'mean_DV'))
plot1 <- plot1 +geom_point(aes(color= factor(Treatment), shape = factor(Compound), size = count, alpha = factor(PROT))) +
# legend labels
labs(color = 'Randomised Dose (mg)', shape = 'Compound',
size = 'Number of subjects', alpha = 'Protocol') +
scale_alpha_discrete(range = c(1, .6, .4, .2, .1)) +
facet_grid(.~Disease) + ylab(paste(yvar))
scale_x_continuous(expand = c(0.2, 0.2))
PROT, Treatment, and Compound are the names of some of the columns in fdata. When I run this code and produce a ggplot, I get a legend that looks like this, which is what I want:
After converting the ggplot to plotly, I get a legend that is much less organized and much more confusing. How can I get plotly to produce a legend like the first one?