Title: | 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. |
Authors: | Monika Furdyna [aut, ctr, cre]
|
Maintainer: | Monika Furdyna <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.1.9001 |
Built: | 2025-03-03 19:19:32 UTC |
Source: | https://github.com/rmi-pacta/r2dii.plot |
A table of column names and descriptions of data frames used or exported by the functions in this package.
data_dictionary
data_dictionary
data_dictionary
Name of the dataset
Name of the column
Type of the column
Definition of the column
data_dictionary
data_dictionary
Create an emission intensity plot
plot_emission_intensity(data)
plot_emission_intensity(data)
data |
A data frame like the output of |
An object of class "ggplot".
sda.
# plot with `qplot_emission_intensity()` parameters data <- subset(sda, sector == "cement" & region == "global") %>% prep_emission_intensity(span_5yr = TRUE, convert_label = to_title) plot_emission_intensity(data)
# plot with `qplot_emission_intensity()` parameters data <- subset(sda, sector == "cement" & region == "global") %>% prep_emission_intensity(span_5yr = TRUE, convert_label = to_title) plot_emission_intensity(data)
Create a techmix plot
plot_techmix(data)
plot_techmix(data)
data |
A data frame like the output of |
An object of class "ggplot".
# plot with `qplot_techmix()` parameters data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) %>% prep_techmix( span_5yr = TRUE, convert_label = recode_metric_techmix, convert_tech_label = spell_out_technology ) plot_techmix(data)
# plot with `qplot_techmix()` parameters data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) %>% prep_techmix( span_5yr = TRUE, convert_label = recode_metric_techmix, convert_tech_label = spell_out_technology ) plot_techmix(data)
Create a trajectory plot
plot_trajectory(data, center_y = FALSE, perc_y_scale = FALSE)
plot_trajectory(data, center_y = FALSE, perc_y_scale = FALSE)
data |
A data frame like the outputs of
|
center_y |
Logical. Use |
perc_y_scale |
Logical. |
An object of class "ggplot".
# plot with `qplot_trajectory()` parameters data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) %>% prep_trajectory() plot_trajectory( data, center_y = TRUE, perc_y_scale = TRUE )
# plot with `qplot_trajectory()` parameters data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) %>% prep_trajectory() plot_trajectory( data, center_y = TRUE, perc_y_scale = TRUE )
Prepare data for a emission intensity plot
prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)
prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)
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 |
A data-frame ready to be plotted using plot_emission_intensity()
.
sda.
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") prep_emission_intensity(data)
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") prep_emission_intensity(data)
Prepare data for plotting technology mix
prep_techmix( data, convert_label = identity, span_5yr = FALSE, convert_tech_label = identity )
prep_techmix( data, convert_label = identity, span_5yr = FALSE, convert_tech_label = identity )
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 |
A data-frame ready to be plotted using plot_techmix()
.
# `data` must meet documented "Requirements" data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) prep_techmix(data)
# `data` must meet documented "Requirements" data <- subset( market_share, 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
prep_trajectory( data, convert_label = identity, span_5yr = FALSE, value_col = "percentage_of_initial_production_by_scope" )
prep_trajectory( data, convert_label = identity, span_5yr = FALSE, value_col = "percentage_of_initial_production_by_scope" )
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. |
A data-frame ready to be plotted using plot_trajectory()
.
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) prep_trajectory(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) prep_trajectory(data)
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.
qplot_emission_intensity(data)
qplot_emission_intensity(data)
data |
A data frame like the output of |
An object of class "ggplot".
plot_emission_intensity
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") qplot_emission_intensity(data)
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") qplot_emission_intensity(data)
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.
qplot_techmix(data)
qplot_techmix(data)
data |
A data frame like the output of |
An object of class "ggplot".
plot_techmix
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & region == "global" & scenario_source == "demo_2020" & metric %in% c("projected", "corporate_economy", "target_sds") ) qplot_techmix(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & region == "global" & scenario_source == "demo_2020" & metric %in% c("projected", "corporate_economy", "target_sds") ) qplot_techmix(data)
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.
qplot_trajectory(data)
qplot_trajectory(data)
data |
A data frame like the outputs of
|
An object of class "ggplot".
plot_trajectory
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) qplot_trajectory(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) qplot_trajectory(data)
All datasets have at least two columns:
label
: Text label of the colour.
hex
: Hex code of the colour.
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
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.
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
Other datasets:
market_share
,
sda
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
A custom discrete colour and fill scales with colours from 2DII palette.
scale_colour_r2dii(colour_labels = NULL, ...) scale_fill_r2dii(colour_labels = NULL, ...)
scale_colour_r2dii(colour_labels = NULL, ...) scale_fill_r2dii(colour_labels = NULL, ...)
colour_labels |
A character vector. Specifies colour labels to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other r2dii scales:
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
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()
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()
A custom discrete colour and fill scales with colours from 2DII sector palette.
scale_colour_r2dii_sector(sectors = NULL, ...) scale_fill_r2dii_sector(sectors = NULL, ...)
scale_colour_r2dii_sector(sectors = NULL, ...) scale_fill_r2dii_sector(sectors = NULL, ...)
sectors |
A character vector. Specifies sector colours to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other r2dii scales:
scale_colour_r2dii()
,
scale_colour_r2dii_tech()
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()
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()
A custom discrete colour and fill scales with colours from 2DII technology palette.
scale_colour_r2dii_tech(sector, technologies = NULL, ...) scale_fill_r2dii_tech(sector, technologies = NULL, ...)
scale_colour_r2dii_tech(sector, technologies = NULL, ...) scale_fill_r2dii_tech(sector, technologies = NULL, ...)
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 |
An object of class "ScaleDiscrete".
Other r2dii scales:
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
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")
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")
sda
-like datasetDataset imitating the output of r2dii.analysis::target_sda()
.
sda
sda
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 110 rows and 6 columns.
https://github.com/RMI-PACTA/r2dii.plot/issues/55.
Other datasets:
market_share
,
r2dii_colours
sda
sda
A ggplot theme which can be applied to all graphs to appear according to 2DII plotting aesthetics.
theme_2dii( base_size = 12, base_family = "Helvetica", base_line_size = base_size/22, base_rect_size = base_size/22 )
theme_2dii( base_size = 12, base_family = "Helvetica", base_line_size = base_size/22, base_rect_size = base_size/22 )
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 |
An object of class "theme", "gg".
library(ggplot2, warn.conflicts = FALSE) ggplot(mtcars) + geom_histogram(aes(mpg), bins = 10) + theme_2dii()
library(ggplot2, warn.conflicts = FALSE) ggplot(mtcars) + geom_histogram(aes(mpg), bins = 10) + theme_2dii()
qplot_*()
functionsto_title()
converts labels like qplot_emission_intensity()
.
recode_metric_trajectory()
converts labels like qplot_trajectory()
.
recode_metric_techmix()
converts labels like qplot_techmix()
.
spell_out_technology()
converts technology labels like qplot_techmix()
.
to_title(x) recode_metric_techmix(x) recode_metric_trajectory(x) spell_out_technology(x)
to_title(x) recode_metric_techmix(x) recode_metric_trajectory(x) spell_out_technology(x)
x |
A character vector. |
A character vector.
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"))
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"))