-1

This question is related to this one.

I'm trying to use loess() inside ggplot2's stat_smooth(), this way :

ggplot(data = mydf, aes(x=time, y=pdm, z=surface))
    + geom_point() + stat_smooth(col="red") 
    + stat_quantile(formula = loess(mydf$pdm ~ mydf$time), quantiles = c(0.25, 0.5, 0.75))

However, I get the following error message :

Warning messages:

1: 'newdata' had 100 rows but variables found have 6816 rows

2: Computation failed in 'stat_quantile()':

replacement has 6816 rows, data has 100

Any idea of what is going on / how to get it to work ?

Thanks

Community
  • 1
  • 1
François M.
  • 4,027
  • 11
  • 30
  • 81

1 Answers1

0

stat_quantile doesn't support this. formula should be a formula object, which is then passed to the method. If you need Additive Quantile Regression Smoothing use method = "rqss". If you want to use stat_smooth actually use stat_smooth. However, the formula will still expect a formula object, but you can use loess as a method there.

Roland
  • 127,288
  • 10
  • 191
  • 288