plot_trajectory: Create a trajectory alignment chart in a ggplot object

Description Usage Arguments Examples

View source: R/plot_trajectory.R

Description

The function returns a ggplot object containing a stacked bar chart showing a technology mix for different categories (portfolio, scenario, benchmark, etc.).

Usage

1
2
3
4
5
6
plot_trajectory(
  data,
  scenario_specs_good_to_bad,
  main_line_metric,
  additional_line_metrics = NULL
)

Arguments

data

Filtered input data; with columns: year, metric_type, metric and value.

scenario_specs_good_to_bad

Dataframe containing scenario specifications like name label, ordered from the most to least sustainable; with columns: scenario, label.

main_line_metric

Dataframe containing information about metric that should be plotted as the main line; with columns: metric, label.

additional_line_metrics

Dataframe containing information about additional metrics that should be plotted as lines; with columns: metric, label).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
data <- prepare_for_trajectory_chart(
  process_input_data(example_data),
  sector_filter = "power",
  technology_filter = "renewablescap",
  region_filter = "global",
  scenario_source_filter = "demo_2020",
  value_name = "production"
)

scenario_specs <- dplyr::tibble(
  scenario = c("sds", "sps", "cps"),
  label = c("SDS", "STEPS", "CPS")
)

main_line_metric <- dplyr::tibble(metric = "projected", label = "Portfolio")

additional_line_metrics <- dplyr::tibble(
  metric = "corporate_economy",
  label = "Corporate Economy"
)

p <- plot_trajectory(data,
  scenario_specs_good_to_bad = scenario_specs,
  main_line_metric = main_line_metric
)

p

2DegreesInvesting/r2dii.plot.static documentation built on Dec. 17, 2021, 6:37 a.m.