Madagascar Report Card - Benthic Cover and Fish Biomass

Published 19 May 2025, Updated 03 Sep 2025
172
By James P.W. Robinson - Coral Reef Ecologist, Lancaster University, Iain R. Caldwell - Lead Data Analyst, MERMAID,
Benthic PIT
Fishbelt
R
Quarto
Scatterplot
Bar Plot

Context

This example is based on a "Madagascar Report Card", originally created by James Robinson, to compare benthic cover and fish biomass among sites in Madagascar and attempt to identify whether there are patterns between benthic cover and fish biomass among those sites. Visualizing fish and benthic cover data together like this can be helpful for identifying if fish biomass and benthic cover are related among the sites and whether some sites are doing much better than others. This could be a first step in then examining possible reasons for those differences.

Getting and reshaping data

In this article we focus on the code for the visualizations but the full resource (see the bottom of this page for link) also includes how to get the data using the “mermaidr” package and some necessary reshaping of the data. If you want to fully recreate the visualization code below you should refer to that full resource.

Benthic cover by site and category

Stacked horizontal barplot

One of the first visualizations in the report card is a horizontal stacked bar plot showing the % cover of all high level benthic categories for each site as stacked horizontal bars. Visualizing the data in this way makes it easier to see differences across sites. Flipping the bars so they are horizontal rather than vertical is advantageous as you can include variable numbers of sites without changing the width of the plot. Sites are also ordered from highest to lowest % hard coral, with the values for % hard coral shown on the left, so that it is particularly easy to compare that benthic category across sites.

Fish biomass by site and trophic group

Stacked horizontal barplot

Fish biomass can also be visualized in a similar way. In this second visualization from the report card, the length of the bar represents the total biomass and each color within the bar represents a trophic group. The code is quite similar but we thought it would be useful to show an example focusing on fish biomass as well. 

Comparing fish biomass and benthic cover

Scatter plot with fitted GAM 

There are also visualizations in the report card that combine fish biomass and benthic cover. The example below shows how fish biomass varies with % cover of different benthic categories using faceted scatterplots. Within each scatterplot, the data is fitted to a generalized additive model (GAM) using the geom_smooth function. You will notice that there is no fitted line in the facet for crustose coralline algae (CCA) - this is because there are too many zeroes for % cover (i.e. a lot of the surveys had no CCA). Although we do not show it here, there is another visualization combining fish biomass and benthic cover In the full resource (link below) showing how fish biomass of different trophic groups varies with % hard coral cover.