View source: R/scale_colour_2dii.R
scale_colour_2dii | R Documentation |
A custom discrete colour and fill scales with colours from 2DII palettes.
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,
...
)
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 |
labels |
Labels parameter to be used in |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.