ecometric_space_qual {commecometrics} | R Documentation |
Plot ecometric space for qualitative environmental variables
Description
Visualizes the predicted ecometric space (predicted category) and probability maps
for each category based on the output from ecometric_model_qualitative()
.
Usage
ecometric_space_qual(
model_out,
category_labels = NULL,
palette = NULL,
fossil_data = NULL,
fossil_color = "#000000",
modern_color = "#bc4749",
x_label = "Summary metric 1",
y_label = "Summary metric 2"
)
Arguments
model_out |
Output from |
category_labels |
Optional named vector for category labels (used in the legend title). If |
palette |
Optional color vector for categories (must match number of categories). |
fossil_data |
Optional. Output from |
fossil_color |
Outline color for fossil data bins (default = "#000000"). |
modern_color |
Outline color for modern data bins (default: |
x_label |
Label for the x-axis in the output plots (default: "Summary metric 1"). |
y_label |
Label for the y-axis in the output plots (default: "Summary metric 2"). |
Value
A list containing:
ecometric_space_plot |
ggplot showing the predicted category across trait space. |
probability_maps |
List of ggplots showing probability surfaces for each category. |
Examples
# Load internal data
data("geoPoints", package = "commecometrics")
data("traits", package = "commecometrics")
data("spRanges", package = "commecometrics")
data("fossils", package = "commecometrics")
# Summarize trait values at sampling points
traitsByPoint <- summarize_traits_by_point(
points_df = geoPoints,
trait_df = traits,
species_polygons = spRanges,
trait_column = "RBL",
species_name_col = "sci_name",
continent = FALSE,
parallel = FALSE
)
# Run ecometric model for qualitative variable
modelResult <- ecometric_model_qual(
points_df = traitsByPoint$points,
category_col = "vegetation",
min_species = 3
)
# Reconstruct fossil environmental categories
reconQual <- reconstruct_env_qual(
fossildata = fossils,
model_out = modelResult,
match_nearest = TRUE,
fossil_lon = "Long",
fossil_lat = "Lat",
modern_id = "ID",
modern_lon = "Longitude",
modern_lat = "Latitude"
)
# Plot qualitative ecometric space
ecoPlotQual <- ecometric_space_qual(
model_out = modelResult,
fossil_data = reconQual
)
# Display predicted category map
print(ecoPlotQual$ecometric_space_plot)
# Display one of the probability maps
print(ecoPlotQual$probability_maps[["1"]])