plot_2d_smooth {stgam} | R Documentation |
Plots a 2-Dimensional GAM smooth
plot_2d_smooth(mod, filled = FALSE, outline = NULL, ncol = NULL, nrow = NULL)
mod |
a GAM model with smooths created using the |
filled |
|
outline |
the name of an |
ncol |
the number of columns for the compound plot |
nrow |
the number of rows for the compound plot |
A compound plot of the 2-dimensional smooths (rendered using cowplot::plot_grid
).
library(mgcv)
library(ggplot2)
library(dplyr)
library(metR)
library(cowplot)
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
# use x1 and x2 as the coordinates
b <- gam(y~s(x0, x1, bs = 'gp', by = x2),data=dat)
plot_2d_smooth(b, filled = TRUE)