mmap: Regional mapping

Description Usage Arguments Details Value Examples

Description

Map geographic locations as points colored by values.

Usage

1
2
3
mmap(x, field, name = field, title = "", alpha = NA, sizept = 1,
  sizetxt = 1, xlim = c(-122, -75), ylim = c(25, 49.5), bg = NA,
  colorscale, midval = 0.6, ...)

Arguments

x

data.frame of observations.

field

character, name of column in x by which to color points.

name

character, name for color scale.

title

character, main title.

alpha

numeric vector, values used for relative alpha transparency.

sizept, sizetxt

numeric, relative size for points and text.

xlim

numeric vector, x limits (longitude in decimal degrees).

ylim

numeric vector, y limits (latitude in decimal degrees).

bg

character, background fill for land area (defaults to transparent).

colorscale

character, one of c('bw','bw2','inferno', 'discretebw') defining the color scale.

midval

numeric, value at color scale midpoint when colorscale = 'bw2'.

...

further arguments passed to ggplot2 color scales (for example, transformations).

Details

Plot continuous or discrete values mapped across regions of North America.

Value

Returns or plots an object inheriting from class 'ggplot'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# iris data
set.seed(1959)
x <- iris[,1:3]
n <- NROW(x)
# add geographic structure
x <- data.frame(
     x,
     lon = seq(-80,-120,len=n) + rnorm(n,0,2),
     lat = seq(30,45,len=n) + rnorm(n,0,2),
     Sepal.Big = as.factor(ifelse(x$Sepal.Length > 6,1,0)))
(mmap(x, 'Sepal.Length', alpha=1, name='Sepal length'))
(mmap(x, 'Sepal.Length', alpha=1, name='Sepal length',
      colorscale='inferno'))
(mmap(x, 'Sepal.Big',  name='Sepal > 6 mm'))

phytomosaic/vuln documentation built on Sept. 21, 2019, 8:23 a.m.