Learn R Programming

monographaR (version 1.0)

mapBatch: Generates map in batch mode

Description

This wrapper function will export maps for all species in data.

Usage

mapBatch(data, type = "simple", zoom = T, margin = 0.1, shape, 
raster = NULL, points.col = "black", points.border = "gray50",
points.cex = 1, shape.col = "white", shape.border = "black", 
raster.col = rev(gray.colors(65, start = 0, end = 1)), 
raster.legend = F, export = "pdf", tiff.width = 100, 
tiff.height = 100, ...)

Arguments

data
data.frame
type
"simple" or "user"
zoom
logical
margin
numeric, 0 to 1
shape
a single or a list of spatial shape objects, when type = "user"
raster
a raster object
points.col
character
points.border
character
points.cex
numeric
shape.col
character
shape.border
character
raster.col
vector of colors, when a raster is provided
raster.legend
logical
export
"pdf" or "tiff"
tiff.width
numeric, in mm
tiff.height
numeric, in mm
...
additional arguments for plotting the extra shapes, when type = "user"

Value

  • Exports a pdf or tiff files.

Details

The function has two output options: a single pdf with all maps (export = "pdf") or individual tiff files for each species (export = "tiff"). It requires a data.frame with three columns, ordered as: species, longitude and latitude. If zoom = TRUE, the function will set the limits of the plot using the distribution of each species plus the margin (relative value). If zoom = FALSE, the function will use the distribution of the whole data to set the limits (all maps will have the same limits). Colors can be changed with the arguments points.col, shape.col, shape.border, while the size of the points can be changed with points.cex. A raster layer can be provided (elevation for instance), and the colors of the raster are controlled by raster.col. Optionally, the user can provide a single or a list of shape files (type = "user").

See Also

maptools raster

Examples

Run this code
## loading the example data

data(monographaR_examples)
monographaR_examples$map_data -> data
head(data)

## running the function

# mapBatch(data , type="simple", zoom=T, margin=0.2, points.col="black",
# points.border="white", shape.col="gray90", points.cex=1.5, shape.border 
# = "gray90", export="pdf")

Run the code above in your browser using DataLab