draw.difference_smooth {gratia} | R Documentation |
Plot differences of smooths
Description
Plot differences of smooths
Usage
## S3 method for class 'difference_smooth'
draw(
object,
select = NULL,
rug = FALSE,
ref_line = FALSE,
contour = FALSE,
contour_col = "black",
n_contour = NULL,
ci_alpha = 0.2,
ci_col = "black",
smooth_col = "black",
line_col = "red",
scales = c("free", "fixed"),
ncol = NULL,
nrow = NULL,
guides = "keep",
xlab = NULL,
ylab = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
angle = NULL,
...
)
Arguments
object |
a fitted GAM, the result of a call to |
select |
character, logical, or numeric; which smooths to plot. If
|
rug |
logical; |
ref_line |
logical; |
contour |
logical; should contour lines be added to smooth surfaces? |
contour_col |
colour specification for contour lines. |
n_contour |
numeric; the number of contour bins. Will result in
|
ci_alpha |
numeric; alpha transparency for confidence or simultaneous interval. |
ci_col |
colour specification for the confidence/credible intervals band. Affects the fill of the interval. |
smooth_col |
colour specification for the the smooth or difference line. |
line_col |
colour specification for drawing reference lines |
scales |
character; should all univariate smooths be plotted with the
same y-axis scale? If Currently does not affect the y-axis scale of plots of the parametric terms. |
ncol , nrow |
numeric; the numbers of rows and columns over which to spread the plots |
guides |
character; one of |
xlab , ylab , title , subtitle , caption |
character; labels with which to annotate plots |
angle |
numeric; the angle at which the x axis tick labels are to be
drawn passed to the |
... |
additional arguments passed to |
Examples
load_mgcv()
# simulate some data; a factor smooth example
df <- data_sim("eg4", seed = 42)
# fit GAM
m <- gam(y ~ fac + s(x2, by = fac) + s(x0), data = df, method = "REML")
# calculate the differences between pairs of smooths the f_j(x2) term
diffs <- difference_smooths(m, select = "s(x2)")
draw(diffs)