这是一个ggplot:
ggplot(data.and.factors.prov,aes(x=Design.Complexity,y=FP,shape=factor(All.interactions))) +
stat_summary(fun.data=mean_cl_normal,position=position_dodge(width=0.5)) +
geom_blank() +
geom_smooth(method='lm',se=F,formula=y~x,colour='black') +
scale_shape_manual(values=c(17,3,16,6,15,4),
name='Interactions',
labels=c('No interactions','All possible interactions','Randomly picked interactions\nand direct effects')) +
labs(x='Design.complexity',y='FP',title='Under Bonferroni Correction') +
opts(axis.line = theme_segment(colour = "black"),
panel.grid.major = theme_blank(),
panel.grid.minor = theme_blank(),
panel.border = theme_blank(),
panel.background = theme_blank()) + ylim(0.03,0.06)
如果我按组替换形状:
按颜色替换形状/组时:
ggplot(data.and.factors.prov,aes(x=Design.Complexity,y=FP,colour=factor(All.interactions))) +
stat_summary(fun.data=mean_cl_normal,position=position_dodge(width=0.5)) +
geom_blank() +
geom_smooth(method='lm',se=F,formula=y~x,colour='black') +
scale_shape_manual(values=c(17,3,16,6,15,4),
name='Interactions',
labels=c('No interactions','All possible interactions','Randomly picked interactions\nand direct effects')) +
labs(x='Design.complexity',y='FP',title='Under Bonferroni Correction') +
opts(axis.line = theme_segment(colour = "black"),
panel.grid.major = theme_blank(),
panel.grid.minor = theme_blank(),
panel.border = theme_blank(),
panel.background = theme_blank()) + ylim(0.03,0.06)
同时使用颜色和组
为什么在使用形状时会得到3次回归,但在使用颜色时只获得1次回归?
使用颜色时如何获得3色回归?使用形状时如何才能获得1回归?
答案 0 :(得分:0)
只需在geom_smooth()中删除color ='black',它就会自动为您提供3次回归。
如果你想要3个黑色回归,你可以在aes()中同时使用group = factor(All.interactions)和color = factor(All.interactions),并在geom_smooth()中保持color ='black'