Skip to content

Commit

Permalink
Changes in upcoming ggplot2 version (#153)
Browse files Browse the repository at this point in the history
* regenerate namespace

* replace deprecated theme arguments

* Test for scale equality differently

* Add news bullets
  • Loading branch information
teunbrand authored Feb 8, 2024
1 parent 61476cb commit 2cd9393
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ggthemes (development version)

- Updated tests.
- Removed `legend.title.align` and `legend.text.align` from themes.
- Remove deprecated `n3alt` argument from `tremmel_shape_pal`. Use `alt` instead.
- Deprecate `scale_shape_circlefill` and `circlefill_shape_pal`. The unicode characters
used to represent circles in the scale are too often different sizes. Will be removed
Expand Down
2 changes: 0 additions & 2 deletions R/economist.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ theme_economist <- function(base_size = 10, base_family = "sans",
legend.key.height = NULL,
legend.key.width = NULL,
legend.text = element_text(size = rel(1.25)),
legend.text.align = NULL,
legend.title = element_text(size = rel(1), hjust = 0),
legend.title.align = NULL,
legend.position = "top",
legend.direction = NULL,
legend.justification = "center",
Expand Down
3 changes: 1 addition & 2 deletions R/stata.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ theme_stata_base <- function(base_size = 11, base_family = "sans") {
legend.text = element_text(size = rel(relsz["medsmall"])),
legend.text.align = NULL,
## See textboxstyle leg_title
legend.title = element_text(size = rel(relsz["large"]), hjust = 0),
legend.title.align = 0.5,
legend.title = element_text(size = rel(relsz["large"]), hjust = 0.5),
legend.position = "bottom",
legend.direction = NULL,
legend.justification = "center",
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/helper-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ expect_hexcolor <- function(object) {

invisible(act$val)
}

expect_equal_scale <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}
2 changes: 1 addition & 1 deletion tests/testthat/test-canva.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("scale_colour_canva works", {
})

test_that("scale_color_canva works", {
expect_equal(scale_color_canva(), scale_colour_canva())
expect_equal_scale(scale_color_canva(), scale_colour_canva())
})

test_that("scale_colour_canva works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-colorblind.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_that("scale_colour_colorblind works", {
})

test_that("scale_color_canva works", {
expect_equal(scale_color_colorblind(), scale_colour_colorblind())
expect_equal_scale(scale_color_colorblind(), scale_colour_colorblind())
})

test_that("scale_fill_colorblind works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-economist.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_that("economist_pal raises warning with large number", {
})

test_that("scale_colour_economist equals scale_color_economist", {
expect_equal(scale_color_economist(), scale_colour_economist())
expect_equal_scale(scale_color_economist(), scale_colour_economist())
})

test_that("scale_colour_economist works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-few.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("scale_colour_few works", {
})

test_that("scale_color_few works", {
expect_equal(scale_color_few(), scale_colour_few())
expect_equal_scale(scale_color_few(), scale_colour_few())
})

test_that("scale_fill_few works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-gdocs.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_that("scale_colour_gdocs works", {
})

test_that("scale_color_gdocs works", {
expect_equal(scale_color_gdocs(), scale_colour_gdocs())
expect_equal_scale(scale_color_gdocs(), scale_colour_gdocs())
})

test_that("theme_gdocs works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-hc.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("scale_colour_hc works", {
})

test_that("scale_color_hc works", {
expect_equal(scale_colour_hc(), scale_color_hc())
expect_equal_scale(scale_colour_hc(), scale_color_hc())
})

test_that("scale_fill_hc works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-solarized.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_that("scale_colour_solarized works", {
})

test_that("scale_color_solarized works", {
expect_equal(scale_colour_solarized(), scale_color_solarized())
expect_equal_scale(scale_colour_solarized(), scale_color_solarized())
})

test_that("scale_fill_solarized works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-stata.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_that("scale_colour_stata works", {
})

test_that("scale_color_stata works", {
expect_equal(scale_colour_stata(), scale_color_stata())
expect_equal_scale(scale_colour_stata(), scale_color_stata())
})

test_that("scale_fill_stata works", {
Expand Down

0 comments on commit 2cd9393

Please sign in to comment.