If you would like to return to information from the previous session, please click here.
Working with fish abundance data from coral reef monitoring presents some different challenges to the benthic percent cover data. Although the taxonomy for bony fishes is relatively stable, the notation of the taxa can come in a number of different formats, with common names, taxonomic Family, and a mixture of genus and genus species designation. Additionally, coral reef fish abundance data can include size classes, which are necessary to convert to fish biomass - one of the key GCRMN reporting variables.
These differences in the information represented in fish transect data require a slightly different approach to visualisation.
This wiki page aims to provide some additional approaches to visualising taxonomic and size class information contained in typical coral reef fish monitoring data.
As with previous examples and consistent with the general project
workflow, a plotting script should start by loading clean data from an
data_intermediate
*.rda
file:
# point to data locale
data_locale <- "data_intermediate/examples/formatting/"
# call to data
load(paste0(data_locale, "kenya_fishes_data.rda"))
And, as is good practise, a quick look at the object properties can be helpful in screening any potential problems with the data and also guide strategies for plotting, such as the number of sites and taxa involved:
# get number of Stations
kenya_fishes_data$Station %>% unique() %>% sort()
# [1] "Coral garden" "Coral Garden" "Dive Point" "Kilvulini" "Light house"
# [6] "Mkwiro" "Northreef" "Nyali" "Old Coral Garden" "Raswatini"
# [11] "Richard Barnett" "Star Fish"
# clean up coral garden
kenya_fishes_data %<>%
mutate(Station = Station %>% str_to_title()) # %>% pull(Station) %>% unique() %>% sort()
## -- explore taxonomy -- ##
# get list of names
kenya_fishes_data$`Common name` %>% unique() %>% sort()
# [1] "Angelfish" "Baracuda" "Butterfly fish" "Emperors" "Goatfish"
# [6] "Groupers" "Grunt/Sweetlips" "Jacks" "Parrotfish" "Rabbitfish"
# [11] "Sharks" "Snappers" "Surgeon fish" "Triggerfish" "Wrasses"
# get list of families
kenya_fishes_data$Family %>% unique() %>% sort()
# [1] "Acanthuridae" "Balistidae" "Carangidae" "Chaetodontidae" "Haemulidae"
# [6] "Labridae" "Lethrinidae" "Lutjanidae" "Mullidae" "Pomacanthidae"
# [11] "Rhincodontidae" "Scaridae" "Serranidae" "Siganidae" "Sphyraenidae"
As the Kenya fishes data has a number of sites, taxa, and size classes, it can be informative to focus in on a key functional group or taxa of interest to visualise trends across sites.
In this example, we are interested in looking at size class
differences for Serranidae
across sites, including the
variation. We achieve this by summarising the data and calculating the
standard deviations by Station
and
size_class
:
# set groups of interest
groups_of_interest <-
c("Serranidae")
# visualise
kenya_fishes_data %>%
dplyr::filter(Family %in% groups_of_interest) %>%
group_by(Station,
Family,
size_class) %>%
summarise(abundance_sd = abundance %>% sd(na.rm = TRUE),
abundance_mean = abundance %>% mean(na.rm = TRUE)) %>%
mutate(sd_upper = abundance_mean + abundance_sd,
sd_lower = abundance_mean - abundance_sd) %>%
ungroup() %>%
mutate(size_class = size_class %>% factor(levels = size_order)) %>%
ggplot(aes(Station, abundance_mean)) +
geom_point(size = 2.0, alpha = 0.7) +
geom_errorbar(aes(ymax = sd_upper,
ymin = sd_lower,
colour = Station),
alpha = 0.7) +
theme_bw() +
facet_grid(size_class ~ .) +
ylab("Mean abundance") +
ggtitle("Kenya fishes") +
scale_colour_manual(values = scales::brewer_pal(palette = "BrBG")(11)) +
theme(plot.title = element_text(hjust = 0.5),
strip.background = element_blank(),
strip.text.y = element_text(angle = 0))
Which produces something like this:
Note that we can improve the resolution of the y-axis by adding
facet_grid(size_class ~ ., scales = "free_y") +
to the
plot. The Station
names would also be easier to read if
they were assigned a element_text(angle = 90)
to the
theme()
.
In order to compare multiple taxa, we can use
facet_grid(Station ~ Family, scales = "free_y") +
to align
the families. Note that this example also uses an “on-the-fly”
data summary prior to the plotting:
## -- facet by Station -- ##
# set colour palette
c_palette <-
scales::brewer_pal(palette = "BrBG")(11)
# visualise
kenya_fishes_data %>%
dplyr::filter(Family %in% groups_of_interest) %>%
group_by(Station,
Family,
size_class) %>%
summarise(abundance_sd = abundance %>% sd(na.rm = TRUE),
abundance_mean = abundance %>% mean(na.rm = TRUE)) %>%
mutate(sd_upper = abundance_mean + abundance_sd,
sd_lower = abundance_mean - abundance_sd) %>%
ungroup() %>%
mutate(size_class = size_class %>% factor(levels = size_order)) %>%
ggplot(aes(size_class, abundance_mean)) +
geom_point(size = 2.0,
alpha = 0.7) +
geom_errorbar(aes(ymax = sd_upper,
ymin = sd_lower,
colour = Station),
alpha = 0.7) +
theme_bw() +
facet_grid(Station ~ Family, scales = "free_y") +
ylab("Mean abundance") +
ggtitle("Kenya fishes") +
scale_colour_manual(values = c_palette) +
theme(plot.title = element_text(hjust = 0.5),
legend.position = "none",
strip.background = element_blank(),
strip.text.y = element_text(angle = 0))
Note that we are switching the colour palette and can use this to help visualise the trends across the different levels:
As course participants should already have started with their Homework for this
module, there should be other geoms
and facets
that can help visualise the different levels contained within coral reef
fish monitoring data.