This plot function can be used to visualize bioregions based on a
bioregion.clusters
object combined with a geometry (sf
objects).
Arguments
- clusters
An object of class
bioregion.clusters
or adata.frame
. If adata.frame
is used, the first column should represent the sites' ID, and the subsequent column(s) should represent the clusters.- geometry
A spatial object that can be handled by the
sf
package. The first attribute should correspond to the sites' ID (see Details).- write_clusters
A
boolean
indicating if theclusters
should be added to thegeometry
.- plot
A
boolean
indicating if the plot should be drawn.- ...
Further arguments to be passed to
sf::plot()
.
Value
One or several maps of bioregions if plot = TRUE
and the
geometry with additional clusters' attributes if write_clusters = TRUE
.
Details
The clusters
and geometry
site IDs should correspond. They should
have the same type (i.e., character
if clusters
is a
bioregion.clusters
object) and the sites of clusters
should be
included in the sites of geometry
.
Author
Maxime Lenormand (maxime.lenormand@inrae.fr)
Boris Leroy (leroy.boris@gmail.com)
Pierre Denelle (pierre.denelle@gmail.com)
Examples
data(fishmat)
data(fishsf)
net <- similarity(fishmat, metric = "Simpson")
clu <- netclu_greedy(net)
map <- map_bioregions(clu, fishsf, write_clusters = TRUE, plot = FALSE)