2013-04-21 13 views
6

私はgeom_smoothから回帰直線を削除して、信頼区間を維持しようとしています。私はsize = 0size = NULL、およびsize = NAを試しましたが、何もしません。誰もが知っている簡単な回避策はありますか?ggplot2のgeom_smoothから行を削除してください

baseball <- ddply(x, .(id), transform, bat.avg = h/ab) 
hank <- subset(baseball, id == 'aaronha01') 
ggplot(hank, aes(x = year, y = bat.avg)) + 
    geom_line(size = 1.2, color = '#336699') + 
    geom_smooth(fill = '#bf3030', size = NA) + 
    labs(x = '', y = '') 

Hank Aaron's Batting Average

+0

もっと一般的には、ggplot2の外で線形モデルを計算し、結果を手動でプロットすることができます。 @Didzisの答えはこの場合でもはるかに簡単です。 –

答えて

12

あなたは行を削除するにはgeom_smooth()linetype=0を設定することができます。 size=0設定

ggplot(mtcars,aes(wt,mpg))+geom_smooth(linetype=0) 

enter image description here

+0

うん、それはトリックでした!ありがとうDidzis! – maloneypatr

0

も行を削除します。そして明らかにsize= NAも。

ggplot(mtcars,aes(wt,mpg))+geom_smooth(size=0) 
関連する問題