Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: r2dii.plot
Title: Visualize the Climate Scenario Alignment of a Financial Portfolio
Version: 0.4.0.9009
Version: 0.4.0.9010
Authors@R:
c(person(given = "Monika",
family = "Furdyna",
Expand Down
30 changes: 28 additions & 2 deletions R/scale_colour_r2dii.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,39 @@
#' geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
#' scale_fill_r2dii()
scale_colour_r2dii <- function(colour_labels = NULL, ...) {
discrete_scale("colour", "r2dii", r2dii_pal(colour_labels), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "colour",
palette = r2dii_pal(colour_labels),
...
)
} else {
discrete_scale(
aesthetics = "colour",
scale_name = "r2dii",
palette = r2dii_pal(colour_labels),
...
)

Check warning on line 39 in R/scale_colour_r2dii.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii.R#L34-L39

Added lines #L34 - L39 were not covered by tests
}
}

#' @rdname scale_colour_r2dii
#' @export
scale_fill_r2dii <- function(colour_labels = NULL, ...) {
discrete_scale("fill", "r2dii", r2dii_pal(colour_labels), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "fill",
palette = r2dii_pal(colour_labels),
...
)
} else {
discrete_scale(
aesthetics = "fill",
scale_name = "r2dii",
palette = r2dii_pal(colour_labels),
...
)

Check warning on line 58 in R/scale_colour_r2dii.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii.R#L53-L58

Added lines #L53 - L58 were not covered by tests
}
}

r2dii_pal <- function(colour_labels = NULL) {
Expand Down
30 changes: 28 additions & 2 deletions R/scale_colour_r2dii_sector.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,39 @@
#' geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
#' scale_fill_r2dii_sector()
scale_colour_r2dii_sector <- function(sectors = NULL, ...) {
discrete_scale("colour", "r2dii_sector", r2dii_sec_pal(sectors), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "colour",
palette = r2dii_sec_pal(sectors),
...
)
} else {
discrete_scale(
aesthetics = "colour",
scale_name = "r2dii_sector",
palette = r2dii_sec_pal(sectors),
...
)

Check warning on line 40 in R/scale_colour_r2dii_sector.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii_sector.R#L35-L40

Added lines #L35 - L40 were not covered by tests
}
}

#' @rdname scale_colour_r2dii_sector
#' @export
scale_fill_r2dii_sector <- function(sectors = NULL, ...) {
discrete_scale("fill", "r2dii_sector", r2dii_sec_pal(sectors), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "fill",
palette = r2dii_sec_pal(sectors),
...
)
} else {
discrete_scale(
aesthetics = "fill",
scale_name = "r2dii_sector",
palette = r2dii_sec_pal(sectors),
...
)

Check warning on line 59 in R/scale_colour_r2dii_sector.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii_sector.R#L54-L59

Added lines #L54 - L59 were not covered by tests
}
}

r2dii_sec_pal <- function(sectors = NULL) {
Expand Down
30 changes: 28 additions & 2 deletions R/scale_colour_r2dii_tech.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,39 @@
#' geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) +
#' scale_fill_r2dii_tech("automotive")
scale_colour_r2dii_tech <- function(sector, technologies = NULL, ...) {
discrete_scale("colour", "r2dii_tech", r2dii_tech_pal(sector, technologies), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "colour",
palette = r2dii_tech_pal(sector, technologies),
...
)
} else {
discrete_scale(
aesthetics = "colour",
scale_name = "r2dii_tech",
palette = r2dii_tech_pal(sector, technologies),
...
)

Check warning on line 44 in R/scale_colour_r2dii_tech.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii_tech.R#L39-L44

Added lines #L39 - L44 were not covered by tests
}
}

#' @rdname scale_colour_r2dii_tech
#' @export
scale_fill_r2dii_tech <- function(sector, technologies = NULL, ...) {
discrete_scale("fill", "r2dii_tech", r2dii_tech_pal(sector, technologies), ...)
if (utils::packageVersion("ggplot2") >= numeric_version("3.5.0")) {
discrete_scale(
aesthetics = "fill",
palette = r2dii_tech_pal(sector, technologies),
...
)
} else {
discrete_scale(
aesthetics = "fill",
scale_name = "r2dii_tech",
palette = r2dii_tech_pal(sector, technologies),
...
)

Check warning on line 63 in R/scale_colour_r2dii_tech.R

View check run for this annotation

Codecov / codecov/patch

R/scale_colour_r2dii_tech.R#L58-L63

Added lines #L58 - L63 were not covered by tests
}
}

r2dii_tech_pal <- function(sector, technologies = NULL) {
Expand Down
Loading