Description Usage Arguments Value Examples
View source: R/plot_functions.R
Simple method to plot a linear model using ggplot along with 95
1 2 |
data |
The linear model object from |
mapping |
Regular mapping, see |
vars |
A list of variable values used for prediction. |
... |
Additional arguments passed to |
A ggplot class object.
1 2 3 4 5 6 7 8 9 | ggplot2::ggplot(
lm(mpg ~ hp * qsec, data = mtcars),
ggplot2::aes(hp, mpg, linetype = factor(qsec)),
vars = list(
hp = min(mtcars$hp):max(mtcars$hp),
qsec = round(mean(mtcars$qsec) + c(-1, 1) * sd(mtcars$qsec)), 1)) +
ggplot2::geom_ribbon(ggplot2::aes(ymin = LL, ymax = UL), alpha = .2) +
ggplot2::geom_line() +
ggplot2::theme_bw()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.