Skip to content

Commit de975d2

Browse files
authored
Merge pull request #189 from jrnold/update-deprecated-function-warnings
Refactor discrete_scale calls to use named arguments for palette
2 parents 3096636 + 2a8feda commit de975d2

File tree

16 files changed

+44
-45
lines changed

16 files changed

+44
-45
lines changed

R/calc.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ calc_pal <- function() {
5454
#' @export
5555
#' @seealso See \code{\link{theme_calc}()} for examples.
5656
scale_fill_calc <- function(...) {
57-
discrete_scale("fill", "calc", calc_pal(), ...)
57+
discrete_scale("fill", palette = calc_pal(), ...)
5858
}
5959

6060
#' @export
6161
#' @rdname scale_calc
6262
scale_colour_calc <- function(...) {
63-
discrete_scale("colour", "calc", calc_pal(), ...)
63+
discrete_scale("colour", palette = calc_pal(), ...)
6464
}
6565

6666
#' @export
@@ -90,7 +90,7 @@ calc_shape_pal <- function() {
9090
#' @export
9191
#' @seealso \code{\link{theme_calc}()} for examples.
9292
scale_shape_calc <- function(...) {
93-
discrete_scale("shape", "calc", calc_shape_pal(), ...)
93+
discrete_scale("shape", palette = calc_shape_pal(), ...)
9494
}
9595

9696
# PT_TO_MM <- 0.352778

R/canva.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ canva_pal <- function(palette = "Fresh and bright") {
4848
#' @inheritParams canva_pal
4949
#' @export
5050
scale_colour_canva <- function(..., palette = "Fresh and bright") {
51-
discrete_scale("colour", "canva", canva_pal(palette), ...)
51+
discrete_scale("colour", palette = canva_pal(palette), ...)
5252
}
5353

5454
#' @export
@@ -58,5 +58,5 @@ scale_color_canva <- scale_colour_canva
5858
#' @export
5959
#' @rdname scale_colour_canva
6060
scale_fill_canva <- function(..., palette = "Fresh and bright") {
61-
discrete_scale("fill", "canva", canva_pal(palette), ...)
61+
discrete_scale("fill", palette = canva_pal(palette), ...)
6262
}

R/colorblind.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ colorblind_pal <- function() {
2424
#' @rdname colorblind
2525
#' @export
2626
scale_colour_colorblind <- function(...) {
27-
discrete_scale("colour", "colorblind", colorblind_pal(), ...)
27+
discrete_scale("colour", palette = colorblind_pal(), ...)
2828
}
2929

3030
#' @rdname colorblind
@@ -34,5 +34,5 @@ scale_color_colorblind <- scale_colour_colorblind
3434
#' @rdname colorblind
3535
#' @export
3636
scale_fill_colorblind <- function(...) {
37-
discrete_scale("fill", "colorblind", colorblind_pal(), ...)
37+
discrete_scale("fill", palette = colorblind_pal(), ...)
3838
}

R/economist.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ economist_pal <- function(fill = TRUE) {
112112
#' @seealso \code{\link{theme_economist}()} for examples.
113113
#' @export
114114
scale_colour_economist <- function(...) {
115-
discrete_scale("colour", "economist", economist_pal(), ...)
115+
discrete_scale("colour", palette = economist_pal(), ...)
116116
}
117117

118118
#' @rdname scale_economist
@@ -122,7 +122,7 @@ scale_color_economist <- scale_colour_economist
122122
#' @rdname scale_economist
123123
#' @export
124124
scale_fill_economist <- function(...) {
125-
discrete_scale("fill", "economist", economist_pal(), ...)
125+
discrete_scale("fill", palette = economist_pal(), ...)
126126
}
127127

128128
#' ggplot color theme based on the Economist

R/excel.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ excel_new_pal <- function(theme = "Office Theme") {
5050
#' @export
5151
#' @example inst/examples/ex-theme_excel.R
5252
scale_fill_excel <- function(...) {
53-
discrete_scale("fill", "excel", excel_pal(line = FALSE), ...)
53+
discrete_scale("fill", palette = excel_pal(line = FALSE), ...)
5454
}
5555

5656
#' @export
5757
#' @rdname scale_excel
5858
scale_colour_excel <- function(...) {
59-
discrete_scale("colour", "excel", excel_pal(line = TRUE), ...)
59+
discrete_scale("colour", palette = excel_pal(line = TRUE), ...)
6060
}
6161

6262
#' @export
@@ -74,7 +74,7 @@ scale_color_excel <- scale_colour_excel
7474
#' @example inst/examples/ex-theme_excel_new.R
7575
#' @export
7676
scale_colour_excel_new <- function(theme = "Office Theme", ...) {
77-
discrete_scale("colour", "excel_new", excel_new_pal(theme), ...)
77+
discrete_scale("colour", palette = excel_new_pal(theme), ...)
7878
}
7979

8080
#' @export
@@ -84,7 +84,7 @@ scale_color_excel_new <- scale_colour_excel_new
8484
#' @export
8585
#' @rdname scale_excel_new
8686
scale_fill_excel_new <- function(theme = "Office Theme", ...) {
87-
discrete_scale("fill", "excel_new", excel_new_pal(theme), ...)
87+
discrete_scale("fill", palette = excel_new_pal(theme), ...)
8888
}
8989

9090
#' ggplot theme based on old Excel plots

R/few.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ few_pal <- function(palette = "Medium") {
5959
#' @rdname scale_few
6060
#' @export
6161
scale_colour_few <- function(palette = "Medium", ...) {
62-
discrete_scale("colour", "few", few_pal(palette), ...)
62+
discrete_scale("colour", palette = few_pal(palette), ...)
6363
}
6464

6565
#' @export
@@ -69,7 +69,7 @@ scale_color_few <- scale_colour_few
6969
#' @export
7070
#' @rdname scale_few
7171
scale_fill_few <- function(palette = "Light", ...) {
72-
discrete_scale("fill", "few", few_pal(palette), ...)
72+
discrete_scale("fill", palette = few_pal(palette), ...)
7373
}
7474

7575
#' Theme based on Few's "Practical Rules for Using Color in Charts"
@@ -141,5 +141,5 @@ few_shape_pal <- function() {
141141
#' scale uses.
142142
#' @export
143143
scale_shape_few <- function(...) {
144-
discrete_scale("shape", "few", few_shape_pal(), ...)
144+
discrete_scale("shape", palette = few_shape_pal(), ...)
145145
}

R/fivethirtyeight.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fivethirtyeight_pal <- function() {
6363
#' @seealso \code{\link{theme_fivethirtyeight}()} for examples.
6464
#' @export
6565
scale_colour_fivethirtyeight <- function(...) {
66-
discrete_scale("colour", "economist", fivethirtyeight_pal(), ...)
66+
discrete_scale("colour", palette = fivethirtyeight_pal(), ...)
6767
}
6868

6969
#' @rdname scale_fivethirtyeight
@@ -73,5 +73,5 @@ scale_color_fivethirtyeight <- scale_colour_fivethirtyeight
7373
#' @rdname scale_fivethirtyeight
7474
#' @export
7575
scale_fill_fivethirtyeight <- function(...) {
76-
discrete_scale("fill", "economist", fivethirtyeight_pal(), ...)
76+
discrete_scale("fill", palette = fivethirtyeight_pal(), ...)
7777
}

R/gdocs.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ gdocs_pal <- function() {
113113
#' @export
114114
#' @seealso See \code{\link{theme_gdocs}()} for examples.
115115
scale_fill_gdocs <- function(...) {
116-
discrete_scale("fill", "gdocs", gdocs_pal(), ...)
116+
discrete_scale("fill", palette = gdocs_pal(), ...)
117117
}
118118

119119
#' @export
120120
#' @rdname scale_gdocs
121121
scale_colour_gdocs <- function(...) {
122-
discrete_scale("colour", "gdocs", gdocs_pal(), ...)
122+
discrete_scale("colour", palette = gdocs_pal(), ...)
123123
}
124124

125125
#' @export

R/hc.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ hc_pal <- function(palette = "default") {
8989
#' @rdname scale_hc
9090
#' @export
9191
scale_colour_hc <- function(palette = "default", ...) {
92-
discrete_scale("colour", "hc", hc_pal(palette), ...)
92+
discrete_scale("colour", palette = hc_pal(palette), ...)
9393
}
9494

9595
#' @rdname scale_hc
@@ -99,5 +99,5 @@ scale_color_hc <- scale_colour_hc
9999
#' @rdname scale_hc
100100
#' @export
101101
scale_fill_hc <- function(palette = "default", ...) {
102-
discrete_scale("fill", "hc", hc_pal(palette), ...)
102+
discrete_scale("fill", palette = hc_pal(palette), ...)
103103
}

R/pander.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ palette_pander <- function(n, random_order = FALSE) {
302302
#' @seealso \code{\link{theme_pander}()}
303303
#' @export
304304
scale_color_pander <- function(...) {
305-
discrete_scale("colour", "pander", palette_pander, ...)
305+
discrete_scale("colour", palette = palette_pander, ...)
306306
}
307307

308308

@@ -314,5 +314,5 @@ scale_colour_pander <- scale_color_pander
314314
#' @rdname scale_pander
315315
#' @export
316316
scale_fill_pander <- function(...) {
317-
discrete_scale("fill", "pander", palette_pander, ...)
317+
discrete_scale("fill", palette = palette_pander, ...)
318318
}

0 commit comments

Comments
 (0)