I have a plot of my data that includes both a boxplot and a point plot (data from mtcars for illustration)
ggplot(mtcars,aes(x=factor(cyl), y=mpg), fill=factor(carb),shape=factor(vs))+
geom_boxplot(data=subset(mtcars,am==1),aes(x = factor(cyl), y = mpg,fill=factor(carb),shape=factor(vs)),outlier.shape = NA, alpha = 0.85, width = .65, colour = "BLACK") +
geom_point(data=subset(mtcars,am==1 & vs==1),aes(x = factor(cyl), y = mpg,fill=factor(carb),shape=factor(vs)),outlier.shape = NA,size=5,alpha=.4,shape=1, colour = "BLACK", position = position_dodge(width = 0.65))
my objective is for there
- to be a single legend instead of two legends
- that now shows all the colors associated with the fill (based on carb) and a single element which explains what the open circles correspond to (i.e. vs==1).
- for that single element (that corresponds to geom_point) to display an open circle (corresponding to the open circle in the graph) and not boxplots as its currently showing.
any help will be greatly appreciated
