powered by
Plots basis functions using ggplot2
# S3 method for basis draw( object, legend = FALSE, labeller = NULL, ylab = NULL, title = NULL, subtitle = NULL, caption = NULL, ncol = NULL, nrow = NULL, angle = NULL, guides = "keep", contour = FALSE, n_contour = 10, contour_col = "black", ... )
A patchwork object.
patchwork
an object, the result of a call to basis().
basis()
logical; should a legend by drawn to indicate basis functions?
a labeller function with which to label facets. The default is to use ggplot2::label_both().
ggplot2::label_both()
character or expression; the label for the y axis. If not supplied, a suitable label will be generated from object.
object
character or expression; the title for the plot. See ggplot2::labs().
ggplot2::labs()
character or expression; the subtitle for the plot. See ggplot2::labs().
character or expression; the plot caption. See ggplot2::labs().
numeric; the numbers of rows and columns over which to spread the plots
numeric; the angle at which the x axis tick labels are to be drawn passed to the angle argument of ggplot2::guide_axis().
angle
ggplot2::guide_axis()
character; one of "keep" (the default), "collect", or "auto". Passed to patchwork::plot_layout()
"keep"
"collect"
"auto"
patchwork::plot_layout()
logical; should contours be draw on the plot using ggplot2::geom_contour().
ggplot2::geom_contour()
numeric; the number of contour bins. Will result in n_contour - 1 contour lines being drawn. See ggplot2::geom_contour().
n_contour - 1
colour specification for contour lines.
arguments passed to other methods. Not used by this method.
Gavin L. Simpson
load_mgcv() df <- data_sim("eg1", n = 400, seed = 42) m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df, method = "REML") bf <- basis(m) draw(bf) bf <- basis(m, "s(x2)") draw(bf)
Run the code above in your browser using DataLab