Description Usage Arguments Details Value Author(s) See Also Examples
This function will generate phenology maps across time (month, week, etc..).
1 2 3 4 |
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 |
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.
RasterStack
Marcelo Reginato
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
# )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.