Delete row from geom_smooth in ggplot2

I am trying to remove a regression line from geom_smooth and keep only the confidence interval. I tried size = 0 , size = NULL and size = NA , but no one works. Is there an easy workaround that anyone knows?

 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

+6
source share
2 answers

You can set linetype=0 inside geom_smooth() to delete a line.

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

enter image description here

+13
source

setting size=0 also removes the line. And obviously size= NA too.

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

All Articles