Skip to content

Commit

Permalink
Remove deprecated argument from discrete scales
Browse files Browse the repository at this point in the history
- the `scale_name` argument of ggplot2::discrete_scale() was deprecated
  in ggplot v3.5.0
- removed all instances of `scale_name =` from the custom scales defined in
  SomaPlotr (ex. `scale_color_soma()`)
  • Loading branch information
amanda-hi committed May 2, 2024
1 parent e9ccb83 commit 4ac5a13
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
1 change: 0 additions & 1 deletion R/style-gender.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ palette_soma_gender <- function(n = 8) {
#' @export
scale_color_soma_gender <- function(...) {
ggplot2::discrete_scale(aesthetics = "color",
scale_name = "soma_gender",
palette = palette_soma_gender, ...)
}

Expand Down
2 changes: 0 additions & 2 deletions R/style-greys.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ palette_soma_greys <- function(n) {
#' @export
scale_color_soma_greys <- function(...) {
ggplot2::discrete_scale(aesthetics = "color",
scale_name = "soma_greys",
palette = palette_soma_greys, ...)
}

Expand All @@ -31,6 +30,5 @@ scale_color_soma_greys <- function(...) {
#' @export
scale_fill_soma_greys <- function(...) {
ggplot2::discrete_scale(aesthetics = "fill",
scale_name = "soma_greys",
palette = palette_soma_greys, ...)
}
6 changes: 2 additions & 4 deletions R/style-risk.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ scale_color_soma_risk <- function(direction = 4, ...) {
palette_soma_risk_ <- function(n) {
palette_soma_risk(direction = direction, n = n)
}
discrete_scale(aesthetics = "color", scale_name = "soma_risk",
palette = palette_soma_risk_, ...)
discrete_scale(aesthetics = "color", palette = palette_soma_risk_, ...)
}


Expand All @@ -66,8 +65,7 @@ scale_fill_soma_risk <- function(direction = 4, ...) {
palette_soma_risk_ <- function(n) {
palette_soma_risk(direction = direction, n = n)
}
discrete_scale(aesthetics = "fill", scale_name = "soma_risk",
palette = palette_soma_risk_, ...)
discrete_scale(aesthetics = "fill", palette = palette_soma_risk_, ...)
}


Expand Down
12 changes: 4 additions & 8 deletions R/style-soma.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@ palette_soma <- function(n, random_order = FALSE) {
#' [ggplot2::scale_fill_gradient()], or [ggplot2::scale_color_gradient()].
#' @export
scale_color_soma <- function(...) {
ggplot2::discrete_scale(aesthetics = "color",
scale_name = "soma",
palette = palette_soma, ...)
ggplot2::discrete_scale(aesthetics = "color", palette = palette_soma, ...)
}


#' @describeIn style-soma
#' fill _discrete_ scale for SomaLogic graphics.
#' @export
scale_fill_soma <- function(...) {
ggplot2::discrete_scale(aesthetics = "fill",
scale_name = "soma",
palette = palette_soma, ...)
ggplot2::discrete_scale(aesthetics = "fill", palette = palette_soma, ...)
}


#' @describeIn style-soma
#' color _continuous_ scale for SomaLogic graphics.
#' @inheritParams ggplot2::scale_color_gradient
#' @export
scale_continuous_color_soma <- function(low = soma_colors2$pink,
scale_continuous_color_soma <- function(low = soma_colors2$pink,
high = soma_colors2$blue, ...) {
ggplot2::scale_color_gradient(low = low, high = high, ...)
}
Expand All @@ -58,7 +54,7 @@ scale_continuous_color_soma <- function(low = soma_colors2$pink,
#' fill _continuous_ scale for SomaLogic graphics.
#' @inheritParams ggplot2::scale_fill_gradient
#' @export
scale_continuous_fill_soma <- function(low = soma_colors2$pink,
scale_continuous_fill_soma <- function(low = soma_colors2$pink,
high = soma_colors2$blue, ...) {
ggplot2::scale_fill_gradient(low = low, high = high, ...)
}

0 comments on commit 4ac5a13

Please sign in to comment.