想问以下,为啥我这个图的图例不显示颜色?谢谢!
图:
代码:
数据长这样
代码文本:
ggplot(data=result.eff[result.eff$r.gcf %in% c("GCFs(S)","C","N","D","P","T"),])+
aes(x = mean, y = r.gcf, fill = r.obj, color = r.c)+
geom_errorbarh(aes(xmin = down, xmax = up), height=0.5, size=0.7 ,position = position_dodge(width = -0.5))+
geom_point(size = 3, position = position_dodge(width = -0.5))+
geom_vline(xintercept = 0, linetype = "dashed", size= 0.7)+
theme_bw()+
theme(axis.title.y=element_blank())+
theme(legend.title=element_blank(),legend.text=element_text(family = "myFont", size = 14),legend.justification=c(.95,0), legend.position=c(.95,0))+
theme(title=element_text(family = "myFont",size=14,),
axis.text.x = element_text(family = "myFont",size=12),
axis.text.y = element_text(family = "myFont",size=12))+
scale_y_discrete(limits = factor(c("GCFs(S)","C","N","D","P","T"), levels=c("GCFs(S)","C","N","D","P","T"))) +
labs(x = "Effect size")+
scale_x_continuous(limits=c(-1.65,1.65),breaks = c(-1.5,-1.0,-0.5,0,0.5,1.0,1.5))+
facet_wrap(vars(r.gro))+
theme(strip.text.x = element_text(family = "myFont",size=14))
图:
代码:
数据长这样
代码文本:
ggplot(data=result.eff[result.eff$r.gcf %in% c("GCFs(S)","C","N","D","P","T"),])+
aes(x = mean, y = r.gcf, fill = r.obj, color = r.c)+
geom_errorbarh(aes(xmin = down, xmax = up), height=0.5, size=0.7 ,position = position_dodge(width = -0.5))+
geom_point(size = 3, position = position_dodge(width = -0.5))+
geom_vline(xintercept = 0, linetype = "dashed", size= 0.7)+
theme_bw()+
theme(axis.title.y=element_blank())+
theme(legend.title=element_blank(),legend.text=element_text(family = "myFont", size = 14),legend.justification=c(.95,0), legend.position=c(.95,0))+
theme(title=element_text(family = "myFont",size=14,),
axis.text.x = element_text(family = "myFont",size=12),
axis.text.y = element_text(family = "myFont",size=12))+
scale_y_discrete(limits = factor(c("GCFs(S)","C","N","D","P","T"), levels=c("GCFs(S)","C","N","D","P","T"))) +
labs(x = "Effect size")+
scale_x_continuous(limits=c(-1.65,1.65),breaks = c(-1.5,-1.0,-0.5,0,0.5,1.0,1.5))+
facet_wrap(vars(r.gro))+
theme(strip.text.x = element_text(family = "myFont",size=14))