mapStats-internal: Internal functions for mapStats package

Description Usage Arguments Author(s)

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 class 'plotStats'
print(x, horizontal.fill = TRUE, num.row = 1, num.col = 1, ...)

Arguments

statmats

a list object produced by calcStats or calcQuantiles containing the matrices of statistics to plot.

map.file

an object of class SpatialPolygonsDataFrame on which the statistics will be plotted.

d.geo.var

a character string of the name of the variable in the data frame d that is the geographic identifier.

map.geo.var

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.

ngroups

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.

separate

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.

paletteName

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.

colorVec

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.

map.label

logical. Default is TRUE; if FALSE, names of the geographic regions will not be labeled on the map outputs.

map.label.names

a character string naming the vector from the [email protected] data.frame to use to label the map. The default is to use map.geo.var.

cex.label

numeric. Character expansion for the labels to be printed.

col.label

color of the label text to be printed. Default is black.

titles

a character string of length equal to the number of statistics to be plotted, in order. Replaces the default plot titles.

cex.title

numeric. Character expansion for the plot titles.

wt.ind

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.

wt.label

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.

var.pretty

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.

geo.pretty

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.

by.pretty

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.

sp_layout.pars

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.

plotbyvar

logical. If TRUE plots will be grouped by variable, otherwise by statistic.

num.col

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.

x

list. A list produced by plotStats containing trellis plot objects.

horizontal.fill

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.

num.row

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.

divs

An object of class classIntervals.

...

Further arguments, usually lattice plot arguments.

Author(s)

Samuel Ackerman


mapStats documentation built on May 2, 2019, 6:52 a.m.