https://github.com/2DegreesInvesting/tiltPlot
Plots for the TILT project
https://github.com/2DegreesInvesting/tiltPlot
tilt
Last synced: 3 months ago
JSON representation
Plots for the TILT project
- Host: GitHub
- URL: https://github.com/2DegreesInvesting/tiltPlot
- Owner: 2DegreesInvesting
- License: gpl-3.0
- Created: 2023-04-21T16:23:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T17:56:30.000Z (6 months ago)
- Last Synced: 2024-10-29T19:14:42.273Z (6 months ago)
- Topics: tilt
- Language: R
- Homepage: https://2degreesinvesting.github.io/tiltPlot/
- Size: 17 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - 2DegreesInvesting/tiltPlot - Plots for the TILT project (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# tiltPlot
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/2DegreesInvesting/tiltPlot/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/2DegreesInvesting/tiltPlot?branch=main)The goal of tiltPlot is to provide plots for the TILT project.
## Installation
You can install the development version of tiltPlot from GitHub with:
```r
# install.packages("pak")
pak::pak("2DegreesInvesting/tiltPlot")
```## Example
```{r}
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
library(tiltPlot)
```### 1. Sankey Plot with financial data
```{r}
financial
``````{r}
fin <- financial
benchmark <- "tilt_sector"
mode <- "equal_weight"
plot_sankey(fin, with_company = TRUE, benchmark = "tilt_sector", mode = "equal_weight") +
ggtitle(
"Sankey Plot",
paste("Stratified by the amount of loan by the bank, with the", mode, "mode", "and benchmark", benchmark)
)
```You can also choose to have the plot without the company node.
```{r}
plot_sankey(fin, with_company = FALSE, benchmark = "tilt_sector", mode = "equal_weight")
```Finally, the user can choose different modes to plot the Sankey plot with financial data available.
```{r}
plot_sankey(fin, with_company = FALSE, benchmark = "tilt_sector", mode = "best_case")
```### 2. Emission profile plots with financial data
```{r}
financial
```On a company level:
```{r}
fin <- financialbenchmarks <- c("all", "unit")
fin |>
filter(company_name == "tilman") |>
bar_plot_emission_profile_financial(benchmarks, mode = "equal_weight") +
labs(title = "Emission profile of all products on a company level, on an equal
weight financial mode")
```On a portfolio level:
```{r}
bar_plot_emission_profile_financial(fin, benchmarks, mode = "equal_weight") +
labs(title = "Emission profile of all products on a portfolio level, on an equal
weight financial mode")
```### 3. Emission profile plots without financial data
```{r}
without_financial
```Plot on a company level.
The user can choose any number of benchmark to be plotted.```{r}
no_fin <- without_financialbenchmarks <- c("unit", "unit_tilt_sector")
company_name <- no_fin$companies_id[1]no_fin |>
filter(companies_id == company_name) |>
bar_plot_emission_profile(benchmarks, mode = "equal_weight", scenario = "1.5C RPS", year = 2030) +
labs(title = "Emission profile of all products on a company level")
```Plot on a portfolio level.
```{r}
bar_plot_emission_profile(no_fin, benchmarks, mode = "equal_weight", scenario = "1.5C RPS", year = 2030) +
labs(title = "Emission profile of all products on a portfolio level")
```### 4. Scatter plot of the emission profiles and transition risk scores, with financial data
```{r}
fin <- financial
scenario <- "IPR"
year <- 2030
benchmarks <- c("all", "unit")
mode <- "best_case"scatter_plot_financial(fin,
benchmarks = benchmarks,
mode = mode,
scenario = scenario,
year = year
)
```### 5. Create a German map with risk categories color gradient, without financial
Different modes can be chosen: "equal_weight", "worst_case" and "best_case".
If nothing is chosen, equal_weight the default mode.```{r}
no_fin <- without_financialmap_region_risk(no_fin, "DE", benchmark = "unit_tilt_sector", mode = "worst_case", scenario = "NZ 2050", year = 2030) +
labs(title = "German map of high, medium and low proportions of the companies
that are found in one region.
© EuroGeographics for the administrative boundaries ")
```