Title: | Visualize the Climate Scenario Alignment of a Financial Portfolio |
Version: | 0.5.2 |
Description: | Create plots to visualize the alignment of a corporate lending financial portfolio to climate change scenarios based on climate indicators (production and emission intensities) across key climate relevant sectors of the 'PACTA' methodology (Paris Agreement Capital Transition Assessment; https://www.transitionmonitor.com/). Financial institutions use 'PACTA' to study how their capital allocation decisions align with climate change mitigation goals. |
License: | MIT + file LICENSE |
URL: | https://rmi-pacta.github.io/r2dii.plot/, https://github.com/RMI-PACTA/r2dii.plot |
BugReports: | https://github.com/RMI-PACTA/r2dii.plot/issues |
Depends: | R (≥ 3.5) |
Imports: | dplyr, ggplot2, ggrepel, glue, r2dii.data, rlang, stringr, scales |
Suggests: | cli, covr, r2dii.analysis, r2dii.match, readr, rmarkdown, spelling, testthat (≥ 3.0.0), waldo |
Config/testthat/edition: | 3 |
Config/Needs/website: | rmi-pacta/pacta.pkgdown.rmitemplate |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-06-17 13:54:41 UTC; cjrmi |
Author: | Monika Furdyna |
Maintainer: | Monika Furdyna <monika.furdyna@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-06-21 13:30:02 UTC |
r2dii.plot: Visualize the Climate Scenario Alignment of a Financial Portfolio
Description
Create plots to visualize the alignment of a corporate lending financial portfolio to climate change scenarios based on climate indicators (production and emission intensities) across key climate relevant sectors of the 'PACTA' methodology (Paris Agreement Capital Transition Assessment; https://www.transitionmonitor.com/). Financial institutions use 'PACTA' to study how their capital allocation decisions align with climate change mitigation goals.
Author(s)
Maintainer: Monika Furdyna monika.furdyna@gmail.com (ORCID) [contractor]
Authors:
Mauro Lepore maurolepore@gmail.com (ORCID) [contractor]
Alex Axthelm alex@2degrees-investing.org (ORCID) [contractor]
Other contributors:
RMI PACTA4banks@rmi.org [copyright holder, funder]
See Also
Useful links:
Report bugs at https://github.com/RMI-PACTA/r2dii.plot/issues
Data Dictionary
Description
A table of column names and descriptions of data frames used or exported by the functions in this package.
Usage
data_dictionary
Format
data_dictionary
- dataset
Name of the dataset
- column
Name of the column
- typeof
Type of the column
- definition
Definition of the column
Examples
data_dictionary
An example of a market_share_demo
-like dataset
Description
Dataset imitating the output of r2dii.analysis::target_market_share()
.
Usage
market_share_demo
Format
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 802 rows and 10 columns.
See Also
r2dii.analysis::target_market_share()
.
Other datasets:
r2dii_colours
,
sda_demo
Examples
market_share_demo
Create an emission intensity plot
Description
Create an emission intensity plot
Usage
plot_emission_intensity(data)
Arguments
data |
A data frame like the output of |
Value
An object of class "ggplot".
See Also
Examples
# plot with `qplot_emission_intensity()` parameters
data <- subset(sda_demo, sector == "cement" & region == "global")
data <- prep_emission_intensity(data, span_5yr = TRUE, convert_label = to_title)
plot_emission_intensity(data)
Create a techmix plot
Description
Create a techmix plot
Usage
plot_techmix(data)
Arguments
data |
A data frame like the output of |
Value
An object of class "ggplot".
See Also
Examples
# plot with `qplot_techmix()` parameters
data <- subset(
market_share_demo,
scenario_source == "demo_2020" &
sector == "power" &
region == "global" &
metric %in% c("projected", "corporate_economy", "target_sds")
)
data <- prep_techmix(
data,
span_5yr = TRUE,
convert_label = recode_metric_techmix,
convert_tech_label = spell_out_technology
)
plot_techmix(data)
Create a trajectory plot
Description
Create a trajectory plot
Usage
plot_trajectory(data, center_y = FALSE, perc_y_scale = FALSE)
Arguments
data |
A data frame like the outputs of
|
center_y |
Logical. Use |
perc_y_scale |
Logical. |
Value
An object of class "ggplot".
See Also
Examples
# plot with `qplot_trajectory()` parameters
data <- subset(
market_share_demo,
sector == "power" &
technology == "renewablescap" &
region == "global" &
scenario_source == "demo_2020"
)
data <- prep_trajectory(data)
plot_trajectory(
data,
center_y = TRUE,
perc_y_scale = TRUE
)
Prepare data for a emission intensity plot
Description
Prepare data for a emission intensity plot
Usage
prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)
Arguments
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
Value
A data-frame ready to be plotted using plot_emission_intensity()
.
See Also
Examples
# `data` must meet documented "Requirements"
data <- subset(sda_demo, sector == "cement" & region == "global")
prep_emission_intensity(data)
Prepare data for plotting technology mix
Description
Prepare data for plotting technology mix
Usage
prep_techmix(
data,
convert_label = identity,
span_5yr = FALSE,
convert_tech_label = identity
)
Arguments
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
convert_tech_label |
A symbol. The unquoted name of a function to apply
to technology legend labels. For example, to convert labels to uppercase
use |
Value
A data-frame ready to be plotted using plot_techmix()
.
See Also
Examples
# `data` must meet documented "Requirements"
data <- subset(
market_share_demo,
scenario_source == "demo_2020" &
sector == "power" &
region == "global" &
metric %in% c("projected", "corporate_economy", "target_sds")
)
prep_techmix(data)
Prepare data for a trajectory plot
Description
Prepare data for a trajectory plot
Usage
prep_trajectory(
data,
convert_label = identity,
span_5yr = FALSE,
value_col = "percentage_of_initial_production_by_scope"
)
Arguments
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
value_col |
Character. Name of the column to be used as a value to be plotted. |
Value
A data-frame ready to be plotted using plot_trajectory()
.
See Also
Examples
# `data` must meet documented "Requirements"
data <- subset(
market_share_demo,
sector == "power" &
technology == "renewablescap" &
region == "global" &
scenario_source == "demo_2020"
)
prep_trajectory(data)
Create a quick emission intensity plot
Description
Compared to plot_emission_intensity()
this function:
is restricted to plotting future as 5 years from the start year,
outputs formatted labels, based on emission metric column,
outputs a title,
outputs formatted axis labels.
Usage
qplot_emission_intensity(data)
Arguments
data |
A data frame like the output of |
Value
An object of class "ggplot".
See Also
plot_emission_intensity
Examples
# `data` must meet documented "Requirements"
data <- subset(sda_demo, sector == "cement" & region == "global")
qplot_emission_intensity(data)
Create a quick techmix plot
Description
Compared to plot_techmix()
this function:
is restricted to plotting future as 5 years from the start year,
outputs pretty bar labels, based on metric column,
outputs pretty legend labels, based on technology column,
outputs a title.
Usage
qplot_techmix(data)
Arguments
data |
A data frame like the output of |
Value
An object of class "ggplot".
See Also
plot_techmix
Examples
# `data` must meet documented "Requirements"
data <- subset(
market_share_demo,
sector == "power" &
region == "global" &
scenario_source == "demo_2020" &
metric %in% c("projected", "corporate_economy", "target_sds")
)
qplot_techmix(data)
Create a quick trajectory plot
Description
Compared to plot_trajectory()
this function:
is restricted to plotting only 5 years from the start year,
outputs pretty legend labels, based on the column holding metrics,
outputs a title,
outputs a subtitle,
outputs informative axis labels in sentence case.
Usage
qplot_trajectory(data)
Arguments
data |
A data frame like the outputs of
|
Value
An object of class "ggplot".
See Also
plot_trajectory
Examples
# `data` must meet documented "Requirements"
data <- subset(
market_share_demo,
sector == "power" &
technology == "renewablescap" &
region == "global" &
scenario_source == "demo_2020"
)
qplot_trajectory(data)
Colour datasets
Description
All datasets have at least two columns:
-
label
: Text label of the colour. -
hex
: Hex code of the colour.
Usage
palette_colours
scenario_colours
sector_colours
technology_colours
Format
An object of class tbl_df
(inherits from tbl
, data.frame
) with 9 rows and 2 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 5 rows and 2 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 8 rows and 2 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 18 rows and 3 columns.
Details
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
See Also
Other datasets:
market_share_demo
,
sda_demo
Examples
palette_colours
scenario_colours
sector_colours
technology_colours
Custom PACTA colour and fill scales
Description
A custom discrete colour and fill scales with colours from the PACTA palette.
Usage
scale_colour_r2dii(colour_labels = NULL, ...)
scale_fill_r2dii(colour_labels = NULL, ...)
Arguments
colour_labels |
A character vector. Specifies colour labels to use and their
order. Run |
... |
Other parameters passed on to |
Value
An object of class "ScaleDiscrete".
See Also
Other r2dii scales:
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
Examples
library(ggplot2, warn.conflicts = FALSE)
ggplot(mpg) +
geom_point(aes(displ, hwy, color = class)) +
scale_colour_r2dii()
ggplot(mpg) +
geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
scale_fill_r2dii()
Custom PACTA sector colour and fill scales
Description
A custom discrete colour and fill scales with colours from the PACTA sector palette.
Usage
scale_colour_r2dii_sector(sectors = NULL, ...)
scale_fill_r2dii_sector(sectors = NULL, ...)
Arguments
sectors |
A character vector. Specifies sector colours to use and their
order. Run |
... |
Other parameters passed on to |
Value
An object of class "ScaleDiscrete".
See Also
Other r2dii scales:
scale_colour_r2dii()
,
scale_colour_r2dii_tech()
Examples
library(ggplot2, warn.conflicts = FALSE)
ggplot(mpg) +
geom_point(aes(displ, hwy, color = class)) +
scale_colour_r2dii_sector()
ggplot(mpg) +
geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
scale_fill_r2dii_sector()
Custom PACTA technology colour and fill scales
Description
A custom discrete colour and fill scales with colours from the PACTA technology palette.
Usage
scale_colour_r2dii_tech(sector, technologies = NULL, ...)
scale_fill_r2dii_tech(sector, technologies = NULL, ...)
Arguments
sector |
A string. Sector name specifying a colour palette. Run
|
technologies |
A character vector. Specifies technologies to use as
colours and their order. Run
|
... |
Other parameters passed on to |
Value
An object of class "ScaleDiscrete".
See Also
Other r2dii scales:
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
Examples
library(ggplot2, warn.conflicts = FALSE)
ggplot(mpg) +
geom_point(aes(displ, hwy, color = class)) +
scale_colour_r2dii_tech("automotive")
ggplot(mpg) +
geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
scale_fill_r2dii_tech("automotive")
An example of an sda_demo
-like dataset
Description
Dataset imitating the output of r2dii.analysis::target_sda()
.
Usage
sda_demo
Format
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 110 rows and 6 columns.
Source
https://github.com/RMI-PACTA/r2dii.plot/issues/55.
See Also
Other datasets:
market_share_demo
,
r2dii_colours
Examples
sda_demo
Complete theme
Description
A ggplot theme which can be applied to all graphs to appear according to the PACTA plotting aesthetics.
Usage
theme_2dii(
base_size = 12,
base_family = "Helvetica",
base_line_size = base_size/22,
base_rect_size = base_size/22
)
Arguments
base_size |
base font size, given in pts. |
base_family |
base font family |
base_line_size |
base size for line elements |
base_rect_size |
base size for rect elements |
Value
An object of class "theme", "gg".
See Also
Examples
library(ggplot2, warn.conflicts = FALSE)
ggplot(mtcars) +
geom_histogram(aes(mpg), bins = 10) +
theme_2dii()
Replicate labels produced with qplot_*()
functions
Description
-
to_title()
converts labels likeqplot_emission_intensity()
. -
recode_metric_trajectory()
converts labels likeqplot_trajectory()
. -
recode_metric_techmix()
converts labels likeqplot_techmix()
. -
spell_out_technology()
converts technology labels likeqplot_techmix()
.
Usage
to_title(x)
recode_metric_techmix(x)
recode_metric_trajectory(x)
spell_out_technology(x)
Arguments
x |
A character vector. |
Value
A character vector.
Examples
to_title(c("a.string", "another_STRING"))
metric <- c("projected", "corporate_economy", "target_xyz", "else")
recode_metric_trajectory(metric)
recode_metric_techmix(metric)
spell_out_technology(c("gas", "ice", "coalcap", "hdv"))