plotStats
creates trellis plot objects that are then printed by print.plotStats
. They are called
internally from within mapStats
. nobsEach
is used by jiggleClass
to
calculate the number of observations in each division. synthetic_US_dataset
generates a synthetic dataset
to be used in examples with the supplied usMap
.
plotStats(statmats, map.file, d.geo.var, map.geo.var, ngroups, separate, paletteName,
colorVec, map.label, map.label.names, cex.label, col.label, titles, cex.title,
wt.ind = FALSE, wt.label, var.pretty, geo.pretty, by.pretty,
sp_layout.pars, plotbyvar, num.col, ...)calcQuantiles(...)
nobsEach(divs)
# S3 method for plotStats
print(x, horizontal.fill = TRUE, num.row = 1, num.col = 1, ...)
synthetic_US_dataset()
Returns a list of plot images. Used only internally within function mapStats
.
Returns a list of data.frame
objects representing statistic values.
Returns a vector of frequency counts of observations in an object of class classIntervals
.
Returns an item of class data.frame
.
a list object produced by calcStats
or calcQuantiles
containing the matrices of statistics to plot.
an object of class SpatialPolygonsDataFrame
on which the statistics will be plotted.
a character string of the name of the variable in the data frame d
that is the geographic identifier.
a character string of the name of the geographic identifier in the data portion of map.file
. This is the counterpart of
d.geo.var
. The default is for this to be the same name as d.geo.var
.
The values of d.geo.var
and map.geo.var
must be coded the same way for merging.
a numeric vector of the number of levels for color plotting of variable statistics. If more than one number is specified, ngroups
will be different in each plot.
logical. Default is TRUE, meaning that class divisions will be calculated separately for each statistic's values. Setting
it to FALSE causes the function to calculate a color key by pooling the values from all the statistics across the by variables.
Generally if you plot multiple statistics on a page with the same color palette, setting separate
to TRUE may cause confusion
because colors will represent different values for each panel.
a character vector containing names of color palettes for the RColorBrewer
function brewer.pal
. See details
below for valid names. The default is to use these palettes for coloring, in which case ngroups
will be restricted to between
3 and 9 levels, since there are at most 9 levels in RColorBrewer
palettes. This is a good simple option.
User-provided palettes can be used instead by specifying the argument colorVec
to override this option. See details below.
a list where each element is vector of ordered colors; they should be ordered from light to dark for a sequential palette. These will override
the use of RColorBrewer
through the paletteName
argument. See the demo for an example of using HCL sequential palettes from the
colorspace
package. Use of the colorVec
argument will override a value provided for ngroups
.
logical. Default is TRUE; if FALSE, names of the geographic regions will not be labeled on the map outputs.
a character string naming the vector from the map.file@data
data.frame to use to label the map. The default is to
use map.geo.var
.
numeric. Character expansion for the labels to be printed.
color of the label text to be printed. Default is black.
a character string of length equal to the number of statistics to be plotted, in order. Replaces the default plot titles.
numeric. Character expansion for the plot titles.
logical. Default is FALSE. If TRUE, weighted statistics were calculated. If map.label
is TRUE, default plot titles will indicate whether weighted
or unweighted statistics were calculated.
logical. Default is TRUE, in which case automatic titles will be followed by the string '(wtd.)' or '(unwtd.)' as appropriate, depending on whether weighted statistics were calculated. If FALSE no label will be added.
a character string used to name the analysis variable in the default plot titles. The default is to use var
as the name in titles.
a character string used to name the geographic class variable in the default plot titles. The default is to use d.geo.var
as the name in titles.
a vector of character strings used to name the by variables (other than the geographic one) in the default panel strip labels. The default is to use the original variable names in by.var
.
a list. This contains additional parameters to be plotted on each panel. See details section below and explanation of sp.layout
in spplot
. An example is provided in the demo file.
logical. If TRUE plots will be grouped by variable, otherwise by statistic.
numeric. To print multiple statistics on one page, indicate the number of columns for panel arrangement. Under the default, one statistic is printed per page.
list. A list produced by plotStats
containing trellis
plot objects.
logical. Default is TRUE, meaning that given the plot arrangement specified with num.row
and num.col
,
plots will be plotted in order left to right then down. FALSE means they will be plotted going down first and then left to right.
The user may need to use the optional lattice
layout
argument to control the layout of panels within a
single plot to make sure the plots print with enough space. Examples are shown in the demo file.
numeric. To print multiple statistics on one page, indicate the number of rows for panel arrangement. Under the default, one statistic is printed per page.
An object of class classIntervals
.
Further arguments, usually lattice plot arguments.
Samuel Ackerman