Learn R Programming

mosaic (version 0.13.0)

mplot: Generic plotting

Description

Generic function plotting for R objects. Currently plots exist for data.frames, lms, (including glms).

Usage

mplot(object, ...)

## S3 method for class 'default': mplot(object, ...)

## S3 method for class 'lm': mplot(object, which = c(1:3, 7), system = c("lattice", "ggplot2", "base"), ask = FALSE, multiplot = "package:gridExtra" %in% search(), par.settings = theme.mosaic(), level = 0.95, title = paste("model: ", deparse(object$call), "\n"), rows = TRUE, ...)

## S3 method for class 'data.frame': mplot(object, format, default = format, system = c("lattice", "ggplot2"), show = FALSE, title = "", ...)

## S3 method for class 'summary.lm': mplot(object, system = c("lattice", "ggplot2"), level = 0.95, par.settings = trellis.par.get(), rows = TRUE, ...)

## S3 method for class 'TukeyHSD': mplot(object, system = c("lattice", "ggplot2"), ylab = "", xlab = "difference in means", title = "Tukey's Honest Significant Differences", par.settings = trellis.par.get(), order = c("asis", "pval", "difference"), ...)

Arguments

object
an R object from which a plot will be constructed.
...
additional arguments. If object is an lm, subsets of these arguments are passed to grid.arrange and to the lattice plotting routines; in particular, nrow and ncol can be used to
which
a numeric vector used to select from 7 potential plots
system
which graphics system to use (initially) for plotting (ggplot2 or lattice). A check box will allow on the fly change of plotting system.
ask
if TRUE, each plot will be displayed separately after the user responds to a prompt.
multiplot
if TRUE and ask == FALSE, all plots will be displayed together.
par.settings
lattice theme settings
level
a confidence level
title
title for plot
rows
rows to show. This may be a numeric vector, TRUE (for all rows), or a character vector of row names.
format, default
default type of plot to create; one of "scatter", "jitter", "boxplot", "violin", "histogram", "density", "frequency polygon", or "map". Unique prefi
show
a logical, if TRUE, the code will be displayed each time the plot is changed.
ylab
label for y-axis
xlab
label for x-axis
order
one of "pval", "diff", or "asis" determining the order of the pair factor, which determines the order in which the differences are displayed on the plot.
data
a data frame containing the variables that might be used in the plot.

Value

  • Nothing. Just for side effects.

Examples

Run this code
if (require(mosaicData)) {
mplot( lm( width ~ length * sex, data=KidsFeet) )
mplot( lm( width ~ length * sex, data=KidsFeet), rows=2:3, which=7 )
}
if (require(mosaicData)) {
mplot( HELPrct )
mplot( HELPrct, "histogram" )
}
if (require(mosaicData)) {
mplot(summary(lm(width ~ length * sex, data=KidsFeet)), system="ggplot")
mplot(summary(lm(width ~ length * sex, data=KidsFeet)), rows=c("sex", "length"))
mplot(summary(lm(width ~ length * sex, data=KidsFeet)), rows=TRUE)
}
if (require(mosaicData)) {
mplot(TukeyHSD( lm(age ~ substance, data=HELPrct) ) )
mplot(TukeyHSD( lm(age ~ substance, data=HELPrct) ), system="ggplot2" )
}

Run the code above in your browser using DataLab