An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# tiltPlot

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/2DegreesInvesting/tiltPlot/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/2DegreesInvesting/tiltPlot/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/2DegreesInvesting/tiltPlot/branch/main/graph/badge.svg)](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 <- financial

benchmarks <- 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_financial

benchmarks <- 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_financial

map_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 ")
```