ecosystem_services {ggsankeyfier}R Documentation

Data on risks to supply ecosystem services

Description

Data indicating a risk resulting from anthropological activities to the marine ecosystem and its capacity to supply services. This data set serves (aggregated from Piet et al. (submitted)) as an example to illustrate the package's features.

Format

ecosystem_services is a data.frame with 3421 rows and 8 columns. The columns are:

This data.frame is in a wide oriented format, typical for most common applications. Each row in the data.frame represents a unique pathway where each activity_tpe poses a risk to an ecosystem sevice_division, via a pressure_cat and biotic_group. Each column either contains information on a specific stage or the overall quantifier (in this case RCSES).

In its present form it is not suitable to directly plot as a Sankey diagram. For that purpose it needs to be pivoted with pivot_stages_longer(). Two different variants are prepared with this function: ecosystem_services_pivot1 and ecosystem_services_pivot2.

The latter pivot contains service_section as an extra feature which can be used for additional decoration of a Sankey diagram. It is therefore more detailed than the first alternative.

ecosystem_services_pivot1 is a data.frame with 112 rows and 5 columns. Columns are:

ecosystem_services_pivot1 is created from ecosystem_services using pivot_stages_longer() and can be used directly in a Sankey diagram (using geom_sankeynode() and geom_sankeyedge())

ecosystem_services_pivot2 is a data.frame with 252 rows and 6. It is the same as ecosystem_services_pivot1 with the exception of a distinct extra column service_division which allows for more detailed aesthetics in a Sankey diagram.

Author(s)

Pepijn de Vries, Gerjan Piet, Jacob Bentley, Ruud Jongbloed, Anne Grundlehner, Jacqueline Tamis

References

Piet GJ, Bentley J, Jongbloed RH, Grundlehner A, Tamis JE, De Vries P (submitted) A Cumulative Impact Assessment on the North Sea Capacity to Supply Ecosystem Services. doi:10.2139/ssrn.4450241

Examples

data("ecosystem_services")
library(ggplot2)

if (requireNamespace("stringr")) {
  library(stringr)

  pos <- position_sankey(v_space = "auto", align = "justify")
  pos_text <- position_sankey(v_space = "auto", align = "justify", nudge_x = 0.1)

  ## A simplified version of the Sankey diagram as published by Piet _et al._ (submitted)
  ggplot(ecosystem_services |>
           pivot_stages_longer(
             c("activity_type", "pressure_cat", "biotic_group", "service_section"),
             "RCSES"),
         aes(x = stage, y = RCSES, group = node, connector = connector, edge_id = edge_id)) +
    geom_sankeyedge(aes(fill = RCSES), position = pos) +
    geom_sankeynode(position = pos) +
    geom_text(aes(label = str_wrap(node, 20)), position = pos_text, stat = "sankeynode",
              hjust = 0, cex = 2) +
    scale_fill_viridis_c(option = "turbo", trans = "sqrt") +
    theme_minimal()
}

[Package ggsankeyfier version 0.1.8 Index]