ggbiome
provides functions to obtain mean annual temperature,
mean annual precipitation and Whittaker's biome type from geographical
coordinates, and to plot locations over the biome diagram.
These functions are intended to obtain data and create objects to be plotted. They involve creating a spatial object of Whittaker's biomes, and downloading climatic data and obtaining the biome using geographical coordinates.
gd_get_biomes_spdf
It returns a SpatialPolygonsDataFrame object of the Whittaker's biomes modified by Ricklefs (2008) in function of mean annual temperature and mean annual precipitation.
gd_get_biome
This function takes a data frame with geographical coordinates or climatic data
and returns the same data frame with extra columns of climatic data (if not
provided) and biome. It also accepts single values for both latitude and
longitude, or both mean annual temperature and mean annual precipitation.
Climatic data is obtained from WorldClim 1.4 using the RFc
package.
The aim of these functions is to produce biome diagrams. They plot either a diagram of the spatial object of the Whittaker's biomes, or site locations over the same diagram.
vis_biome
This function produces a ggplot object of the Whittaker's biomes from a
SpatialPolygonsDataFrame object obtained with gd_get_biomes_spdf
.
It shows each biome as a colored area according to mean annual temperature
and mean annual precipitation.
vis_location_biome
It produces a ggplot object showing the Whittaker's biomes as colored areas
according to mean annual temperature and mean annual precipitation using the
function vis_biome
, and adds sites on it according to their climatic
values, obtained using the function gd_get_biome
if not provided.
gd_get_biome
expects either a data frame with site coordinates or climatic
data (indicating column names for columns that contain this data), or values
of both latitude (si_lat
) and longitude (si_long
) in decimal degrees,
or both mean annual temperature (si_mat
) in degrees Celsiu and mean annual
precipitation (si_map
) in millimeters. It returns a data frame with the
original data and extra columns of mean annual temperature, mean annual
precipitation (if not provided) and biome:
# Load package library(ggbiome) # Create a data frame with coordinates sites <- data.frame(site = c("A", "B"), lat = c(69.49, 41.43), long = c(27.23, 2.07)) # Get temperature, precipitation and biomes gd_get_biome(sites, si_lat = "lat", si_long = "long") # Alternatively, for one site gd_get_biome(si_mat = 15.8, si_map = 622)
vis_location_biome
expects the same input as gd_get_biome
, and returns a
ggplot object showing the biomes with sites over it:
# Create a ggplot diagram of the biomes with sites vis_location_biome(sites, si_lat = "lat", si_long = "long", point_labels = sites$site) # Alternatively, for one site vis_location_biome(si_mat = 15.8, si_map = 622, col_fill = 'red')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.