I have two dodge bar chart which I have put on top of each other to create this plot.
Groups <- c(1, 2,1,2,1,2)
variable <- c("Yes", "Yes", "Maybe", "Maybe", "No", "No")
value <- c(50,60,70,80,90,100)
df <- data.frame(Groups, variable, value)
Groups <- c(1, 2,1,2,1,2)
variable <- c("Yes*", "Yes*", "Maybe*", "Maybe*", "No*", "No*")
value <- c(5,6,7,8,9,10)
df2 <- data.frame(Groups, variable, value)
ggplot() +
geom_bar(data=df, aes(x=Groups, y=value, fill=variable),
stat="identity", position=position_dodge(), alpha=0.2)+
geom_bar(data=df2, aes(x=Groups, y=value, fill=variable),
stat="identity", position=position_dodge())
I would like for the opacity/alpha from the plot behind to show in the legend.
I have tried +guides(colour = guide_legend(override.aes = list(alpha = 0.2)))
but this does not work.
Thanks.