I am using GGPLOT2 to make a forest plot and since I have added in a line of code to change one of the points shape to a diamond, I am getting a double legend ( pic below )
Anyone know how I can keep the colour coded legend, but with the diamond shape from the black legend? And get rid of the black legend!
p2 = ggplot(data=Forestplot,
aes(x = Group,y = RiskRatio, ymin = LowerLimit,
ymax = UpperLimit, shape = Group ))+
geom_pointrange(aes(col=Group, shape = Group))+
scale_shape_manual(values = c(5, 20, 20, 20, 20)) +
geom_hline(aes(fill=Group),yintercept =0, linetype=2)+
xlab('Trait')+ ylab("Effect Size (95% Confidence Interval)")+
geom_errorbar(aes(ymin=LowerLimit, ymax=UpperLimit,col=Group),width=0.5,cex=1)+
facet_wrap(~Condition,strip.position="left",nrow=9,scales = "free_y") +
theme(plot.title=element_text(size=16,face="bold"),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.text.x=element_text(face="bold"),
axis.title=element_text(size=12,face="bold"),
strip.text.y = element_text(hjust=0,vjust = 1,angle=180,face="bold"))+
coord_flip() + guides(col = guide_legend(reverse = TRUE))
p2
This is my first time posting, please let me know if there is more information needed.
name
s andlabel
s for each legend: this post applies. Welcome to SO, but please check to see if your question has been asked before. – Limey