R 如何在ggplot2中更改组的默认美感
我试图在创建错误图时覆盖默认设置。例如,我在以下代码段中有两个不同的“级别”:R 如何在ggplot2中更改组的默认美感,r,ggplot2,R,Ggplot2,我试图在创建错误图时覆盖默认设置。例如,我在以下代码段中有两个不同的“级别”: plot<-ggplot(df, aes(x=variable, y=value, colour=Levels, group=Levels)) + geom_errorbar(aes(ymin=value-se, ymax=value+se), colour="black", width=.1, position=pd) + geom_line(position=pd) + geom_
plot<-ggplot(df, aes(x=variable, y=value, colour=Levels, group=Levels)) +
geom_errorbar(aes(ymin=value-se, ymax=value+se), colour="black", width=.1, position=pd) +
geom_line(position=pd) +
geom_point(position=pd, size=3, shape=21, fill="white"))
plotplot如何为回答者简化一些代码格式。如果你想要黑白图形,为什么要映射color=Levels
?您应该映射fill=Level,linetype=Level
,然后使用scale\u fill\u manual
和scale\u shape\u manual
。非常感谢,罗兰,这对我很有效。@user3218416如果您为您的问题找到了答案,您应该将该解决方案作为答案发布(然后您可以接受它)。
plot<-ggplot(mdf, aes(x=variable, y=value, fill=Levels,
group=Levels,linetype=Levels))+
geom_errorbar(aes(ymin=value-se, ymax=value+se), colour="black", width=.1,
position=pd) +
geom_line(position=pd, colour="black")+scale_shape_manual(values=c("1","2"))+
geom_point(position=pd, size=3, shape=21, colour="black")+
scale_fill_manual(values=c("white","black")))