Generate Multi-Species Pie Charts
multi_species_pie.RdThis 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.
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.