View source: R/gf_resid_gf_squaresid.R
gf_resid | R Documentation |
This function adds vertical lines representing residuals from a linear model to a ggformula plot. The residuals are drawn from the observed data points to the predicted values from the model.
gf_resid(plot, model, linewidth = 0.2, ...)
plot |
A ggformula plot object, typically created with |
model |
A fitted linear model object created using |
linewidth |
A numeric value specifying the width of the residual lines. Default is |
... |
Additional aesthetics passed to |
A ggplot object with residual lines added.
Height_model <- lm(Thumb ~ Height, data = Fingers)
gf_point(Thumb ~ Height, data = Fingers) %>%
gf_model(Height_model) %>%
gf_resid(Height_model, color = "red", alpha = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.