Previous steps

If you would like to return to information from the previous section, please click here.

Context

There are a number of ways to visualise trends of coral reef monitoring data, depending on the level of information contained in the data, variables, and spatial and temporal extent.

In this module, we will be exploring a number of ways to visualise data and provide the basic skills to make plots using ggplot2 and related tools.

The code for the “status” example can be found here: analysis_code/examples/visualisation/plot_percent_cover_acosa.R

Code for the “trends” can be found here: analysis_code/examples/visualisation/plot_kenya_cover.R

Visualising Status

From our previous example, we created some initial summaries of the data to reduce the complexity of the taxonomic groups and obtain quadrat means for each transect.

With these data will will start visualising:

  # create visual
    sessiles_dat_summary %>%
      dplyr::filter(!Grouping %>% is.na()) %>%
    ggplot(aes(Grouping, Value_mean)) +
      geom_boxplot(fill  = "blue",
                   alpha = 0.7) +
      theme_bw() +
      xlab("Functional Group") +
      ylab("Mean Percent Cover")

Which gives us something like:

We can see from this plot is that this region “ACOSA” is dominated by Macroalgae, Non-living subtrata, with some Live coral. Note that the y-axis is “Mean Percent Cover” at the transect level, so we will probably need to check why there are values higher than 100%. We will pick this up later as part of our Exercises, but in essence this figure has provided us with our first data quality check!

A few things to note in the code:

As a way to standardising GCRMN coding projects, we try to standardise this “layering” as much as possible. It is helpful to have elements to be modified (e.g. data, axes, themes) at the beginning or end of a block of code so it is easier to find if modifications are needed.

Next Steps

It is unrealistic to teach all of the potential visualisations and options in ggplot2 in a single lesson. So, we can suggest course participants visit details as part of the tidyverse documentation, including this cheatsheet.

There are also a number of extensions that add to the core ggplot2 functionality that can be explored here.

Now that we have some basic skills to visualise data using ggplot(), we will now explore how to add complexity to the graphics by using additional aesthetics and faceting.