draw.mgcv_smooth {gratia} | R Documentation |
Plot basis functions
Description
Plots basis functions using ggplot2
Usage
## S3 method for class 'mgcv_smooth'
draw(
object,
legend = FALSE,
use_facets = TRUE,
labeller = NULL,
xlab,
ylab,
title = NULL,
subtitle = NULL,
caption = NULL,
angle = NULL,
...
)
Arguments
object |
an object, the result of a call to |
legend |
logical; should a legend by drawn to indicate basis functions? |
use_facets |
logical; for factor by smooths, use facets to show the
basis functions for each level of the factor? If |
labeller |
a labeller function with which to label facets. The default
is to use |
xlab |
character or expression; the label for the x axis. If not
supplied, a suitable label will be generated from |
ylab |
character or expression; the label for the y axis. If not
supplied, a suitable label will be generated from |
title |
character or expression; the title for the plot. See
|
subtitle |
character or expression; the subtitle for the plot. See
|
caption |
character or expression; the plot caption. See
|
angle |
numeric; the angle at which the x axis tick labels are to be
drawn passed to the |
... |
arguments passed to other methods. Not used by this method. |
Value
A ggplot2::ggplot()
object.
Author(s)
Gavin L. Simpson
Examples
load_mgcv()
df <- data_sim("eg4", n = 400, seed = 42)
bf <- basis(s(x0), data = df)
draw(bf)
bf <- basis(s(x2, by = fac, bs = "bs"), data = df)
draw(bf)