Learn R Programming

mosaic (version 0.8-18)

mPlot: Interactive plotting

Description

These functions provide a menu selection system (via manipulate) so that different aspects of a plot can be selected interactively. The ggplot2 or lattice command for generating the plot currently being displayed can be copied to the console, whence it can be copied to a document for later direct, non-interactive use.

Usage

mPlot(data, default = plotType, system = c("lattice", "ggplot2"),
  show = FALSE, title = "", ...)

mMap(data, default = "map", system = "ggplot2", show = FALSE, title = title, ...)

mScatter(data, default = c("scatter", "jitter", "boxplot", "violin"), system = c("lattice", "ggplot2"), show = FALSE, title = "")

mUniplot(data, default = c("histogram", "density", "frequency polygon"), system = c("lattice", "ggplot2"), show = FALSE, title = "")

Arguments

data
a data frame containing the variables that might be used in the plot. Note that for maps, the data frame must contain coordinates of the polygons comprising the map and a variable for determining which corodiantes are part of the same region. See
default
default type of plot to create; one of "scatter", "jitter", "boxplot", "violin", "histogram", "density", "frequency polygon", "xyplot", or
system
which graphics system to use (initially) for plotting (ggplot2 or lattice). A check box will allow on the fly change of plotting system.
show
a logical, if TRUE, the code will be displayed each time the plot is changed.
title
a title for the plot
...
additional arguments

Value

  • Nothing. Just for side effects.

Details

Only mPlot is required by end users. The other plotting functions are dispatched based on the value of default.

Currently maps are only supported in ggplot2 and not in lattice.

Examples

Run this code
mPlot(HELPrct, "scatter")
mPlot(HELPrct, "density")

Run the code above in your browser using DataLab