mapPhenology: Phenology heatmap

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

View source: R/mapPhenology.R

Description

This function will generate phenology maps across time (month, week, etc..).

Usage

1
2
3
4
mapPhenology(data, resolution = 1, time.range = c(1:12), label = "Month", 
binary = T, by_species = F, plot = T, col = rev(heat.colors(12)), 
alpha = 0.8, mfrow = c(4, 3), legend = T, pdf = F, height = 11, 
width = 8.5, filename = "mapPhenology.pdf")

Arguments

data

data.frame

resolution

numeric (degrees)

time.range

numeric (vector of months, weeks, etc...)

label

character ("Month", "Week")

binary

logical

by_species

logical

plot

logical

col

character (vector of colors)

alpha

numeric (0-1)

mfrow

numeric

legend

logical

pdf

logical

height

numerical

width

numerical

filename

character

Details

This wrapper function will generate heatmaps of phenology across a time range. The default is to produce 12 heatmaps plotted on a single plate. This can be changed with the argument time.range, where any numerical range can be provided (representing weeks for instance). The argument mfrow controls the plate layout. It requires a data.frame with four columns, ordered as: species, longitude, latitude and phenology. The phenology column should be numeric (i.e., the number of the month, week or day the specimen was collected with flower/fruit). It is possible to change the resolution of the resulting rasters. The function can produce presence/absence heatmaps (if binary = T) or abundance heatmaps (if binary = F). The abundance values are relative (divided by the maximum abundance observed across all rasters). The function returns a RasterStack that can be exported or used in customized plots. To export a pdf, set "pdf=TRUE". The function wraps around functions of the raster package.

Value

RasterStack

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
28
### load the example data

data(monographaR_examples)
monographaR_examples$mapPhenology -> data
head(data) ## check the first rows

### running the function

# mapPhenology(data, binary=FALSE, by_species=FALSE, legend=FALSE)

### changing the colors

# mapPhenology(data, binary=FALSE, by_species=FALSE, legend=FALSE, col=rev(terrain.colors(55)))

### exporting raster

# require(raster)
# mapPhenology(data, binary=FALSE, by_species=FALSE, legend=FALSE) -> myphenorasters
# plot(myphenorasters[[1]]) ## plot first month
# writeRaster(myphenorasters[[2]], "pheno_month2.asc") ## exporting 2nd month

### making an GIF animation

# require(animation)
# saveGIF(
#  {mapPhenology(data, binary=F, resolution=0.5, by_species=F, legend=F, mfrow=c(1,1))},
#  movie.name="phenology.gif", interval=0.5, ani.width=600, ani.height=600
# )

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