Skip to contents

This function creates pie charts for multiple species-related variables, visualizing the proportion of observations for each species. It handles complex species labels, groups minor proportions under "Other", and applies a custom color palette for each species.

Usage

multi_species_pie(seuil_prop_autres = 0.05, plot_dir = "path/to/your/folder/")

Arguments

seuil_prop_autres

Numeric, default 0.05. Threshold for grouping low-proportion species into "Other".

plot_dir

Character, default "c"path/to/your/folder/". Directory where the output PNG file will be saved.

Value

The function does not return a value but saves the plot as a PNG file.

Details

The function processes a set of predefined variables (`endophagy`, `endophily`, `indoor_HBI`, `outdoor_HBI`, `parous_rate`, `sac_rate`) and generates a pie chart for each. Complex species names are identified and labeled separately. Colors are assigned using a custom palette loaded from a CSV file (`new_palette_density_plots.csv`). All generated plots are combined into a single grid with a shared legend.

The output is saved as a PNG file named "multi_species_piechart.png" in the specified directory.