pbdb_map_richness {paleobioDB} | R Documentation |
Plot a raster showing the richness of taxa
Description
Creates a SpatRaster
object and a plot with richness of
species, genera, families, etc. per cell.
Usage
pbdb_map_richness(
data,
rank = c("species", "genus", "family", "order", "class", "phylum"),
do_plot = TRUE,
res = 5,
col_int = "white",
col_ocean = "black",
col_rich = c("light blue", "blue"),
title = "Taxonomic richness",
...
)
Arguments
data |
Input data frame. This data frame is the output of the
|
rank |
Taxon rank for which richness is calculated. The
options are: |
do_plot |
Logical. If |
res |
The resolution of the |
col_int |
The colour of the mainland. |
col_ocean |
The colour of the ocean. |
col_rich |
Two or more colours that are used to generate the colour gradient showing the richness per cell in the map. |
title |
A title for the plot, to be positioned to the right of the legend. |
... |
Details
The argument show = c("coords", "classext")
in the
pbdb_occurrences()
function is required. We recommend the use
of a cairo device (X11()
) for better visualization of the
graphs. See Examples.
Value
A SpatRaster
object with the richness of the specified
taxon rank per cell. This SpatRaster
object has the resolution
that was specified in the res
argument. The default is res = 5
. Users that wish to work with objects of this type should load
package terra
.
See Also
See pbdb_occurrences()
, map()
, par()
and colors()
help pages.
Examples
## Not run:
data <- pbdb_occurrences(
limit = 1000, vocab = "pbdb", base_name = "mammalia",
show = c("classext", "coords")
)
X11(width = 13, height = 7.8)
pbdb_map_richness(data, res = 8, rank = "genus")
pbdb_map_richness(data, res = 8, rank = "family")
## Get the raster object without plotting the map
pbdb_map_richness(data, res = 8, rank = "family", do_plot = FALSE)
## End(Not run)