2016-07-01 2 views
0

ggplotを使用して、同じグラフ上にいくつかのデータをプロットしています。下に、各行は時点であり、私は手動でscale_color_manual関数を使って選択した色が異なります。 standard errorを含めることができますが、回帰直線の色と一致する標準誤差色があります。Rの回帰直線の周りに同じプロット内の複数の色を持つ標準誤差がありますか?

以下、私はgeom_smooth関数の 'fill'を変更して、標準誤差の色を赤に編集しました。しかし、各行とエラーが一致するように変更する方法を知らないでください。 fill美学を設定し

enter image description here

ggplot(data, aes(x=log10(x), y=y, color=factor(Time)))+ 
    geom_smooth(method="loess", span=2, fill="red") + 
    facet_wrap(~Condition)+ 
    scale_color_manual(name="Time",values=c("red","blue","green")) 

答えて

2

。これは、ggplot()コールまたはgeom_smoothコールで実行できます。

data = data.frame(x = runif(60), y = runif(60), 
        Time = rep(1:3, 20), 
        Condition = factor(rep(1:2, 30))) 

ggplot(data, aes(x=log10(x), y=y, colour=factor(Time), fill = factor(Time)))+ 
    geom_smooth(method="loess", span=2) + 
    facet_wrap(~Condition)+ 
    scale_color_manual(name="Time", values=c("red","blue","green")) + 
    scale_fill_manual(name="Time", values=c("red","blue","green")) 

enter image description here

関連する問題