Skip to contents

This function provides multiple visualizations for biodiversity occurrence data, including occurrence maps, species richness by region, temporal trends, species composition, and more. The user can specify the type of analysis and the type of plot for visualization (e.g., points vs. heatmap, bar vs. map).

Usage

visualize_biodiversity_data(data, analysis_type, plot_type, ...)

Arguments

data

A data frame containing biodiversity occurrence data.

analysis_type

The type of analysis to perform. Options include:

  • "map_occurrences" - Map occurrences as points or heatmap.

  • "species_richness" - Species richness by region as bar chart or map.

  • "temporal_trends" - Temporal trends in species occurrences as line or area chart.

  • "species_composition" - Species composition by family/genus as bar or pie chart.

  • "sampling_effort" - Sampling effort by location as histogram or heatmap.

  • "species_abundance" - Species abundance across sites as boxplot or violin plot.

  • "environment_vs_occurrence" - Scatterplot or smoothed relationship between environmental variables and species occurrence.

  • "coverage_plot" - Data completeness or coverage by region over time as tile or line plot.

  • "sampling_method_breakdown" - Breakdown of sampling methods as bar or pie chart.

  • "rank_abundance" - Rank-abundance plot or abundance histogram.

plot_type

The type of plot to generate for the chosen analysis. Options depend on the analysis_type:

  • "map_occurrences" - Options: "points", "heatmap".

  • "species_richness" - Options: "bar", "map".

  • "temporal_trends" - Options: "line", "area".

  • "species_composition" - Options: "bar", "pie".

  • "sampling_effort" - Options: "histogram", "heatmap".

  • "species_abundance" - Options: "boxplot", "violin".

  • "environment_vs_occurrence" - Options: "scatter", "smooth".

  • "coverage_plot" - Options: "tile", "line".

  • "sampling_method_breakdown" - Options: "bar", "pie".

  • "rank_abundance" - Options: "rank", "histogram".

additional

arguments depending on the specific analysis type. These could include column names for latitude, longitude, species, region, date, etc.

Value

A ggplot2 object representing the requested visualization.

Examples

if (FALSE) { # \dontrun{
# Example: Map occurrences as points
visualize_biodiversity_data(data, analysis_type = "map_occurrences", plot_type = "points")

# Example: Species richness as a bar chart
visualize_biodiversity_data(data, analysis_type = "species_richness", plot_type = "bar")
} # }