Closed MonikaFu closed 9 months ago
See reprex:
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(r2dii.plot)
data <- filter(sda, sector == "cement", region == "global") %>%
dplyr::mutate(
emission_factor_metric = factor(
.data$emission_factor_metric,
levels = c(
"projected",
"corporate_economy",
"target_demo",
"adjusted_scenario_demo"
)
)
)
input_colour_scale <- c(
"projected" = "dark_blue",
"corporate_economy" = "green",
"target_demo" = "grey",
"adjusted_scenario_demo" = "ruby_red"
)
p <- plot_emission_intensity(data, convert_label = to_title)
#> Warning: The `data` argument of `plot_emission_intensity()` must be prepped already as
#> of r2dii.plot 0.4.0.
#> ℹ From the next release you will need to call
#> `r2dii.plot::plot_emission_intensity(data)` prior to calling
#> `r2dii.plot::plot_emission_intensity()`.
#> ℹ Alternatively custom data preparation will also become possible.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
p + scale_colour_r2dii(
colour_labels = input_colour_scale,
)
#> Scale for colour is already present.
#> Adding another scale for colour, which will replace the existing scale.
Created on 2024-01-24 with reprex v2.0.2
c(
"projected" = "dark_blue",
"corporate_economy" = "green",
"target_demo" = "grey",
"adjusted_scenario_demo" = "ruby_red"
)
Follows alphabetical order, not factor level order.
c(
"adjusted_scenario_demo" = "dark_blue",
"corporate_economy" = "green",
"projected" = "grey",
"target_demo" = "ruby_red"
)
It is a similar problem as described in #535 only here is triggered when using the function argument instead of using the
label
column in data.