Package 'r2dii.colours'

Title: 2 Degrees Investing Colour Palettes in Different Formats
Description: Get colour values from different colour palettes used by 2 Degrees Investing (2DII) organization in their reserach streams. Different ways to obtain the colour values are available: dataframe or a function call.
Authors: Monika Furdyna [aut, ctr, cre]
Maintainer: Monika Furdyna <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-11-09 04:07:59 UTC
Source: https://github.com/rmi-pacta/r2dii.colours

Help Index


Named colour vector associated with 1 in 1000

Description

This vector contains names associated with different colours from 1 in 1000 palette.

Usage

colour_aliases_1in1000

Format

An object of class character of length 43.

Examples

colour_aliases_1in1000

colour_aliases_1in1000[c("high_carbon_exposure", "low_carbon_exposure")]

Named colour vector associated with 2DII values

Description

This vector contains names associated with different colours from 2DII palette.

Usage

colour_aliases_2dii

Format

An object of class character of length 38.

Examples

colour_aliases_2dii

colour_aliases_2dii[c("equity", "bonds")]

Named colour vector associated with PACTA sectors and technologies

Description

This vector contains named colours associated with PACTA sectors and technologies.

Usage

colour_aliases_pacta

Format

An object of class character of length 67.

Examples

colour_aliases_pacta

colour_aliases_pacta[c("ice", "hybrid", "electric")]

colour_aliases_pacta[c("steel", "aviation", "cement")]

Named colour vector associated with user survey

Description

This vector contains named colours associated with user survey results plots.

Usage

colour_aliases_survey

Format

An object of class character of length 11.

Examples

colour_aliases_survey

colour_aliases_survey[c("climate_strategy_concrete_goals")]

colour_aliases_pacta[c("Concrete goals", "Climate strategy")]

Colour palette datasets

Description

All datasets have at least two columns:

  • label: Text label of the colour.

  • hex: Hex code of the colour.

Usage

palette_1in1000_background

palette_1in1000_goodbad

palette_1in1000_plot

palette_2dii_plot

palette_2dii_scenario

palette_2dii_sector

palette_2dii_power

palette_2dii_automotive

palette_2dii_oil_gas

palette_2dii_fossil_fuels

Format

An object of class character of length 1.

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 10 rows and 2 columns.

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 6 rows and 2 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 7 rows and 2 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 2 rows and 2 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 3 rows and 2 columns.

Examples

palette_1in1000_background

palette_1in1000_goodbad

palette_1in1000_plot

palette_2dii_plot

palette_2dii_scenario

palette_2dii_sector

palette_2dii_power

palette_2dii_automotive

palette_2dii_oil_gas

palette_2dii_fossil_fuels

Retrieve colour hex values from a palette

Description

Retrieve colour hex values from a palette

Usage

get_colours(
  colour_names = "red",
  palette = r2dii.colours::palette_1in1000_plot
)

Arguments

colour_names

Character string or a vector of character strings with names of colours for which you want to retrieve the hex values.

palette

The dataframe from which the hex values are retrieved. It should contain columns label and hex.

Value

A vector of strings with hex codes in order specified by colour_names.

Examples

# use default palette
get_colours(c("red", "blue"))

# specify which palette to use
get_colours(c("red", "green"), palette = palette_1in1000_goodbad)

Custom 2DII colour and fill scales

Description

A custom discrete colour and fill scales with colours from 2DII palettes.

Usage

scale_colour_2dii(
  palette = c("2dii", "1in1000", "pacta", "survey"),
  colour_groups = NULL,
  labels = NULL,
  ...
)

scale_fill_2dii(
  palette = c("2dii", "1in1000", "pacta", "survey"),
  colour_groups = NULL,
  labels = NULL,
  ...
)

Arguments

palette

String with the name of the colour scale to be used. If not specified then the general 2dii scale is used

colour_groups

A vector containing groups variable to which colours are assigned. It is needed when the data assigned to colour aesthetic are not all contained in colour aliases of the palette. By default it is null and then only names in data that are also found in colour aliases for the palette are coloured.

labels

Labels parameter to be used in ggplot2::scale_colour_manual. By default it is set to an internal function beaudetifying the labels.

...

Other parameters passed on to ggplot2::discrete_scale().

Value

An object of class "ScaleDiscrete".

Examples

library(ggplot2, warn.conflicts = FALSE)
library(r2dii.plot, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)

sda %>%
  filter(emission_factor_metric == "projected") %>%
  ggplot() +
  geom_line(aes(x = year, y = emission_factor_value, colour = sector)) +
  scale_colour_2dii()

mpg %>%
  ggplot() +
  geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
  scale_fill_2dii()

sda %>%
  filter(emission_factor_metric == "projected") %>%
  ggplot() +
  geom_line(aes(x = year, y = emission_factor_value, colour = sector)) +
  scale_colour_2dii(palette = "1in1000", colour_groups = sda$sector)

market_share %>%
  filter(sector == "automotive", year %in% c(2020, 2025), metric == "projected") %>%
  ggplot() +
  geom_bar(
    stat = "identity",
    aes(x = year, y = technology_share, fill = technology)
  ) +
  scale_fill_2dii(palette = "pacta")