[R] questions regarding stat_smooth in ggplot area plot

jovian w.heijstek at gmail.com
Thu Mar 24 15:21:22 CET 2011


Hello,

I drew a simple area plot using ggplot2 using

set <- read.table(file="http://www.jovian.nl/set.csv", head=1,  sep=",")
library(ggplot2)
ggplot() + 
layer(
  data = set, mapping = aes(x = time, y = hours),
  geom = "area", stat="smooth", color="red"
) +
layer(
  data = set, mapping = aes(x = time, y = hours),
  geom = "area", color="red", fill="red", alpha="0.5"
) 

I have two questions about this visualisation:

- The smooth function is too "rough" right now, how do I make it follow the
original values more closely?
- The smooth function turns up with negative values (e.g. at the beginning):
How do I prevent this? (e.g. to use 0 instead of any negative value.)

Thanks,

Werner


--
View this message in context: http://r.789695.n4.nabble.com/questions-regarding-stat-smooth-in-ggplot-area-plot-tp3402632p3402632.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list