Learn R Programming

r2dii.plot

The goal of r2dii.plot is to help you plot PACTA data in an informative, beautiful, and easy way.

Installation

You can install the released version of r2dii.plot from CRAN with:

install.packages("r2dii.plot")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("RMI-PACTA/r2dii.plot")

Example

The r2dii.plot package is designed to work smoothly with other “r2dii” packages – r2dii.data, r2dii.match, and r2dii.analysis. It also plays well with the ggplot2 package, which helps you customize your plots. Here, we’ll use an example data set that comes with r2dii.plot and that resembles the output of the target_market_share() function in the r2dii.analysis package.

library(ggplot2, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
library(r2dii.plot)

Plot trajectory chart

  • Use qplot_*() to quickly get a plot with standard titles and labels.
# `data` must meet documented "Requirements"
data <- market_share_demo %>%
  filter(
    sector == "power",
    technology == "renewablescap",
    region == "global",
    scenario_source == "demo_2020"
  )

qplot_trajectory(data)
  • Use plot_*() for a more “bare” plot that you can customize yourself by modifying the input data and applying ggplot2 functions.
data <- market_share_demo %>%
  filter(
    sector == "power",
    technology == "renewablescap",
    region == "global",
    scenario_source == "demo_2020",
    between(year, 2020, 2035)
  ) %>%
  mutate(
    label = case_when(
      metric == "projected" ~ "Your Portfolio",
      metric == "corporate_economy" ~ "Benchmark (Corp. Econ.)",
      metric == "target_sds" ~ "SDS Scenario",
      metric == "target_sps" ~ "SPS Scenario",
      metric == "target_cps" ~ "CPS Scenario",
      TRUE ~ metric
    )
  )

data %>%
  prep_trajectory() %>%
  plot_trajectory() +
  labs(
    title = "Power production trajectory for Renewables",
    subtitle = "With reference to climate scenarios.",
    x = "Year",
    y = "Production (normalized to 2020)"
  )

For examples of other plots and data sets please visit Get started with r2dii.plot.

Funding

This project has received funding from the European Union LIFE program and the International Climate Initiative (IKI). The Federal Ministry for the Environment, Nature Conservation and Nuclear Safety (BMU) supports this initiative on the basis of a decision adopted by the German Bundestag. The views expressed are the sole responsibility of the authors and do not necessarily reflect the views of the funders. The funders are not responsible for any use that may be made of the information it contains.

Copy Link

Version

Install

install.packages('r2dii.plot')

Monthly Downloads

456

Version

0.5.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Monika Furdyna

Last Published

June 21st, 2025

Functions in r2dii.plot (0.5.2)

r2dii.plot-package

r2dii.plot: Visualize the Climate Scenario Alignment of a Financial Portfolio
scale_colour_r2dii_sector

Custom PACTA sector colour and fill scales
scale_colour_r2dii_tech

Custom PACTA technology colour and fill scales
to_title

Replicate labels produced with qplot_*() functions
plot_emission_intensity

Create an emission intensity plot
qplot_emission_intensity

Create a quick emission intensity plot
plot_techmix

Create a techmix plot
qplot_techmix

Create a quick techmix plot
prep_emission_intensity

Prepare data for a emission intensity plot
prep_techmix

Prepare data for plotting technology mix
plot_trajectory

Create a trajectory plot
prep_trajectory

Prepare data for a trajectory plot
market_share_demo

An example of a market_share_demo-like dataset
data_dictionary

Data Dictionary
scale_colour_r2dii

Custom PACTA colour and fill scales
theme_2dii

Complete theme
r2dii_colours

Colour datasets
qplot_trajectory

Create a quick trajectory plot
sda_demo

An example of an sda_demo-like dataset