我有以下图表,绘制来自两个不同数据框的数据:
ggplot() +
stat_summary( data = d0_400, aes(x=number, y=(1-value), shape=as.factor(0), size=1 ) , fun.y=mean, geom="line" ) +
stat_summary( data = d0_400, aes(x=number, y=(1-value), shape=as.factor(0), size=4 ) , fun.y=mean, geom="point" ) +
stat_summary( data = d1_400, aes(x=number, y=(1-value), shape=as.factor(1), size=1 ) , fun.y=mean, geom="line" ) +
stat_summary( data = d1_400, aes(x=number, y=(1-value), shape=as.factor(1), size=4 ) , fun.y=mean, geom="point" ) +
scale_size(range = c(1,5), guide=FALSE) +
scale_shape_manual(values=c(0,1) )
使用此代码,我得到以下图:
我想取而代之的是:
答案 0 :(得分:1)
对于彩色线条,只需添加colour
参数
p = ggplot() +
stat_summary( data = d0_400, ..., geom="line", colour = "#hexnum" )
此外,快速谷歌的可选问题带我去了here:
提供的解决方案是
p = p + guides(shape=guide_legend(override.aes=list(size=5)))