MakeMap: Plotting points on a map

Description Usage Arguments Value Author(s) See Also Examples

Description

A function that creates a plot of points on a background map pulled from Google Maps' API.

Usage

1
MakeMap(latitude, longitude, e, scaleby, size = 100, col = "blue", symbol = 20, add = FALSE, ...)

Arguments

latitude

the latitude coordinates of points in the plot.

longitude

the longitude coordinates of points in the plot

e

the extent for the map. If not given, the function will determine an extent from the points that were provided.

scaleby

the variable for bubbles to be scaled by in a bubble plot.

size

Allows the user to shrink or expand the size of the plotted points as a percent of the default points size. For example, size = 80 would display points that are 80

col

a specification for the plotting color. Defaults to "blue". You can provide any color name here, like "red", "purple", etc., in quotes. Or, you could use hex values like "FF00FF", again in quotes. See section 'Color Specification' in the par documentation for more.

pch

either an integer specifying a symbol or a single character to be used as the default in plotting points. The default is 20, which corresponds to filled-in circles, but you could use any number between 1 and 25. See points for possible values and their interpretation, or just try using some numbers and see what they do. You could also provide a symbol in quotes, like "m" and all the points would plot as "m"s.

add

a logical value specifying whether you want to add the plot you are creating to the previous one you created (for example, if plotting a different subset in a separate color to be displayed on the same map). Defaults to FALSE.

...

graphical parameters to be passed to points. For example, you could change the size of the dots on the map by passing cex=2.

Value

Produces a map.

Author(s)

Amelia McNamara, James Molyneux

See Also

par, getExtent

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lat <- runif(10, 32, 42)
lon <- runif(10, -124, -114)
scale <- sample(1:10, 10)
type <- as.factor(sample(c("a","b","c"), size = 10, replace = TRUE))
MakeMap(lat, lon)
MakeMap(lat, lon, scaleby = scale)
MakeMap(lat, lon, scaleby = scale, size = 50)   # shrink bubbles by 50%
MakeMap(lat, lon, scaleby = scale, size = 150)  # expand bubbles by 50%
MakeMap(lat, lon, col = type)
MakeMap(lat, lon, scaleby = scale, col = type)

mobilizingcs/MobilizePrime documentation built on May 23, 2019, 5:07 a.m.