-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation of xseq
for stat_smooth()
#5246
Comments
I'm not sure if it is hidden on purpose or not, but typically such options aren't advertised to users because they're considered internal. |
Given it's presence in We should in general document all arguments available to users so the best way forward is to lift the argument up into the constructor and document it |
It's pretty esoteric, so I think we should only bother to document it if it's really required. |
It is more flexible that Currently See an old discussion like https://stackoverflow.com/questions/26705554/extend-geom-smooth-in-a-single-direction |
If folks need that capability, these days I'd recommend that they fit the model themselves. |
@teunbrand gave me a heads up about this issue, so dropping in another possible (bespoke?) pedagogical xseq use, of adding fitted values of the observed values of x as points along smooth line. And also segments between these fitted values and raw data, giving residuals: mtcars |>
ggplot(aes(wt, mpg)) +
geom_point() +
geom_smooth() +
stat_smooth(geom = "point", # draw fitted values as points
color = "blue",
xseq = mtcars$wt) +
stat_smooth(geom = "segment", # draw residuals
color = "darkred",
xseq = mtcars$wt,
xend = mtcars$wt,
yend = mtcars$mpg) |
The
xseq
argument is a sort of hidden option forstat_smooth()
allowing to select where to draw the smooth line.Would it be relevant to mention it in the documentation and eventually to provide an example?
The text was updated successfully, but these errors were encountered: