| plot.gofN {ergm.multi} | R Documentation |
Plotting methods for gofN, making residual and scale-location plots.
Description
The plot() method uses R graphics.
The ggplot2::autoplot() method uses ggplot2 and ggrepel.
Usage
## S3 method for class 'gofN'
plot(
x,
against = NULL,
which = 1:2,
col = 1,
pch = 1,
cex = 1,
bg = 0,
...,
ask = length(which) > 1 && dev.interactive(TRUE),
id.n = 3,
id.label = NULL,
main = "{type} for {sQuote(name)}",
xlab = NULL,
ylim = NULL,
cex.id = 0.75
)
## S3 method for class 'gofN'
autoplot(
x,
against = .fitted,
which = 1:2,
mappings = list(),
geom_args = list(),
id.n = 3,
id.label = NULL
)
Arguments
x |
a |
against |
what the residuals should be plotted against. Note that different methods use different formats: see Details. Categorical ( |
which |
which to plot ( |
col, pch, cex, bg |
vector of values (wrapped in |
... |
additional arguments to |
ask |
whether the user should be prompted between the plots. |
id.n |
maximum number of extreme points to label explicitly. |
id.label |
specification for how extreme points are to be labeled, defaulting to network's index in the combined network. |
main |
a template for the plots' titles; these use |
xlab |
horizontal axis label; defaults to a character representation of |
ylim |
vertical range for the plots, interpreted as in |
cex.id |
scaling factor for characters used to label extreme points; see |
mappings |
a named list of lists of mappings constructed by |
geom_args |
a named list of lists of arguments overriding the defaults for the individual geoms. See Details below. |
Details
For the plot() method, against and id.label can be vectors of values (enclosed in I() to be used as is), a character string identifying a network attribute, or a formula whose RHS gives an expression in terms of network attributes to plot against. The against formula may also contain a .fitted variable which will be substituted with the fitted values.
For autoplot.gofN(), against and id.label are interpreted as
expressions in terms of network attributes and values generated by
augment.gofN(), included .fitted for the fitted values.
Value
autoplot.gofN() returns a list of ggplot objects that
if printed render to diagnostic plots. If there is only one, the
object itself is returned.
Customising autoplot.gofN()
autoplot.gofN() constructs the plots out of ggplot2::ggplot(),
ggplot2::geom_point() (for numeric against), ggplot2::geom_boxplot() for
categorical or ordinal against), and ggplot2::geom_smooth() (for numeric
or ordinal against), and ggrepel::geom_text_repel(). Mappings and
arguments passed through mappings and geom_args override the
respective defaults. They may have elements default (for
ggplot()), point (for geom_point() and geom_boxplot()),
smooth (for geom_smooth), and text (for geom_text_repel()).
See Also
gofN() for examples, plot.lm(), graphics::plot() for regression diagnostic plots and their parameters.