Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何在ggplot2中更改组的默认美感_R_Ggplot2 - Fatal编程技术网

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"))

plot
plot如何为回答者简化一些代码格式。如果你想要黑白图形,为什么要映射
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")))