plot_2d_smooth {stgam}R Documentation

Plots a 2-Dimensional GAM smooth

Description

Plots a 2-Dimensional GAM smooth

Usage

plot_2d_smooth(mod, filled = FALSE, outline = NULL, ncol = NULL, nrow = NULL)

Arguments

mod

a GAM model with smooths created using the mgcv package

filled

logical value to indicate whether a filled plot should be created (TRUE) or not (FALSE)

outline

the name of an sf object to be plotted (NULL is the default)

ncol

the number of columns for the compound plot

nrow

the number of rows for the compound plot

Value

A compound plot of the 2-dimensional smooths (rendered using cowplot::plot_grid).

Examples

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)

[Package stgam version 0.0.1.1 Index]