library(mgcv)
ggplot(mtcars) +
aes(x = hp, y = disp) +
geom_point() +
stat_smooth(
aes(color = "vanilla gam"),
method = "gam"
) +
stat_smooth(
aes(color = "monotonic constraint"),
method = mgcv::scasm,
formula = y ~ s(x, bs = "sc", xt = c("m+"))
)
library(mgcv)
ggplot(mtcars) +
aes(x = hp, y = disp) +
geom_point() +
stat_smooth(
aes(color = "vanilla gam"),
method = "gam"
) +
stat_smooth(
aes(color = "monotonic constraint"),
method = mgcv::scasm,
formula = y ~ s(x, bs = "sc", xt = c("m+"))
)
patchwork::wrap_plots(
ggplot(mtcars) +
geom_point(aes(wt, mpg)) +
theme_grey(),
ggplot(mtcars) +
geom_point(aes(wt, mpg)) +
theme_grey(19)
)
patchwork::wrap_plots(
ggplot(mtcars) +
geom_point(aes(wt, mpg)) +
theme_grey(),
ggplot(mtcars) +
geom_point(aes(wt, mpg)) +
theme_grey(19)
)