mapDiversity: Diversity heatmap

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/mapDiversity.R

Description

This function will generate a diversity heatmap using presence/absence of species on grid cells.

Usage

1
2
3
mapDiversity(data, resolution = 1, plot = T, plot.with.grid = T, 
col=rev(terrain.colors(55)), alpha=0.8, export = F, legend = T, 
filename = "diversity_map")

Arguments

data

data.frame

resolution

numeric, size of the grid cells (degrees)

plot

logical

plot.with.grid

logical, whether or not to add a grid to the plot

col

character, a vector of colors

alpha

numerical, controls color transparency (0-1)

export

logical

legend

logical

filename

character

Details

It requires a data.frame with three columns, ordered as: species, longitude and latitude. The function will plot and return a raster object. The resolution of the grid can be changed by the argument "resolution" (in degrees). It uses functions of the package raster.

Value

A raster object.

Author(s)

Marcelo Reginato

See Also

raster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## loading the example data

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

## running the function

mapDiversity(data , resolution=1, plot=TRUE, plot.with.grid=TRUE)

## Without the grid borders

mapDiversity(data , resolution=1, plot=TRUE, plot.with.grid=FALSE)

## Changing colors

mapDiversity(data , resolution=1, plot=TRUE, col=gray.colors(55))

## Changing transparency

mapDiversity(data , resolution=1, plot=TRUE, alpha=0.5)

## The function returns a raster object

mapDiversity(data , resolution=1, plot=TRUE, alpha=0.5) -> my.div.raster
my.div.raster
plot(my.div.raster)

monographaR documentation built on Oct. 23, 2020, 8:05 p.m.