mid.plots | R Documentation |
mid.plots()
is a convenience function for applying ggmid()
or plot()
to multiple component functions of a "mid" object at once.
It can automatically determine common plotting scales and manage the layout.
mid.plots(
object,
terms = mid.terms(object, interactions = FALSE),
limits = c(NA, NA),
intercept = FALSE,
main.effects = FALSE,
max.nplots = NULL,
engine = c("ggplot2", "graphics"),
...
)
object |
a "mid" object. |
terms |
a character vector of the terms to be visualized. By default, only the main effect terms are used. |
limits |
a numeric vector of length two specifying the mid value limits. |
intercept |
logical. If |
main.effects |
logical. If |
max.nplots |
the maximum number of plots to generate. |
engine |
the plotting engine to use, either "ggplot2" or "graphics". |
... |
optional parameters passed on to |
If engine
is "ggplot2", mid.plots()
returns a list of "ggplot" objects.
Otherwise (i.e., if engine
is "graphics"), mid.plots()
produces plots as side-effects and returns NULL
invisibly.
interpret
, plot.mid
, ggmid
data(diamonds, package = "ggplot2")
set.seed(42)
idx <- sample(nrow(diamonds), 1e4L)
mid <- interpret(price ~ (carat + cut + color + clarity) ^ 2, diamonds[idx, ])
# Plot selected main effects and interaction using the ggplot2 engine
mid.plots(mid, mid.terms(mid, require = "color", remove = "cut"), limits = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.