diff --git a/NEWS.md b/NEWS.md index 9b3499ede..16c447171 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # ggblanket 5.1.0900 -* Updated colours: `"steelblue"` where no col aesthetic, `guardian` where discrete and less than 5 colours, scales:hue_pal otherwise, `viridis::mako` reversed for continuous, and `"grey"` for NA. +* Updated colours: `"steelblue4"` where no col aesthetic, `guardian` where discrete and 4 or less colours, scales:hue_pal for 5 or more colours, `viridis::mako` reversed for continuous, and `"grey"` for NA. * Breaking: removed all `pal_*` functions. * Removed some unnecessary messages. * Fixed bug where `col_breaks` was not working for a numeric `col`. diff --git a/R/gg_area.R b/R/gg_area.R index 74110f81d..33a09ec44 100644 --- a/R/gg_area.R +++ b/R/gg_area.R @@ -409,7 +409,7 @@ gg_area <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_bar.R b/R/gg_bar.R index 295421afa..657f51910 100644 --- a/R/gg_bar.R +++ b/R/gg_bar.R @@ -414,7 +414,7 @@ gg_bar <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_bin_2d.R b/R/gg_bin_2d.R index abe15f190..ff0d00911 100644 --- a/R/gg_bin_2d.R +++ b/R/gg_bin_2d.R @@ -435,7 +435,7 @@ gg_bin_2d <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_blank.R b/R/gg_blank.R index 3919adaa5..9ee27e59c 100644 --- a/R/gg_blank.R +++ b/R/gg_blank.R @@ -787,7 +787,7 @@ gg_blank <- function( } if (!col_scale) { - # if (rlang::is_null(pal)) pal <- "#4682b4" + # if (rlang::is_null(pal)) pal <- "#36648b" # else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_boxplot.R b/R/gg_boxplot.R index d288b4f2a..c181318fc 100644 --- a/R/gg_boxplot.R +++ b/R/gg_boxplot.R @@ -414,7 +414,7 @@ gg_boxplot <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_col.R b/R/gg_col.R index c397fbdc6..04fa049e7 100644 --- a/R/gg_col.R +++ b/R/gg_col.R @@ -420,7 +420,7 @@ gg_col <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_contour.R b/R/gg_contour.R index a5d1c101e..4351e1822 100644 --- a/R/gg_contour.R +++ b/R/gg_contour.R @@ -482,7 +482,7 @@ gg_contour <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_contour_filled.R b/R/gg_contour_filled.R index 8ad37804f..47723bd11 100644 --- a/R/gg_contour_filled.R +++ b/R/gg_contour_filled.R @@ -476,7 +476,7 @@ gg_contour_filled <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_crossbar.R b/R/gg_crossbar.R index 60ac4f75a..62b7a56f4 100644 --- a/R/gg_crossbar.R +++ b/R/gg_crossbar.R @@ -503,7 +503,7 @@ gg_crossbar <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_density.R b/R/gg_density.R index dd6c7277f..72505a374 100644 --- a/R/gg_density.R +++ b/R/gg_density.R @@ -415,7 +415,7 @@ gg_density <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_density_2d.R b/R/gg_density_2d.R index 7cbc0520a..e8a57f4c2 100644 --- a/R/gg_density_2d.R +++ b/R/gg_density_2d.R @@ -440,7 +440,7 @@ gg_density_2d <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_density_2d_filled.R b/R/gg_density_2d_filled.R index 594a23420..6612662f9 100644 --- a/R/gg_density_2d_filled.R +++ b/R/gg_density_2d_filled.R @@ -430,7 +430,7 @@ gg_density_2d_filled <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_errorbar.R b/R/gg_errorbar.R index d1222796e..ad2a7e089 100644 --- a/R/gg_errorbar.R +++ b/R/gg_errorbar.R @@ -500,7 +500,7 @@ gg_errorbar <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_freqpoly.R b/R/gg_freqpoly.R index 3901d0186..26cc4b2d1 100644 --- a/R/gg_freqpoly.R +++ b/R/gg_freqpoly.R @@ -414,7 +414,7 @@ gg_freqpoly <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_hex.R b/R/gg_hex.R index 0b8d4e316..493d4b36c 100644 --- a/R/gg_hex.R +++ b/R/gg_hex.R @@ -440,7 +440,7 @@ gg_hex <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_histogram.R b/R/gg_histogram.R index 2084b45d4..f8c41e86a 100644 --- a/R/gg_histogram.R +++ b/R/gg_histogram.R @@ -415,7 +415,7 @@ gg_histogram <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_jitter.R b/R/gg_jitter.R index 3606ae12c..79188245b 100644 --- a/R/gg_jitter.R +++ b/R/gg_jitter.R @@ -414,7 +414,7 @@ gg_jitter <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_label.R b/R/gg_label.R index 1867bf522..e655798c8 100644 --- a/R/gg_label.R +++ b/R/gg_label.R @@ -85,7 +85,7 @@ #' label = model, #' size = 3.53, #' y_include = c(min(.$mpg) * 0.95, max(.$mpg) * 1.05), -#' pal = c("firebrick", "white", "steelblue"), +#' pal = c(guardian()[2], "white", "#36648b"), #' y_title = "Miles per gallon" #' ) #' @@ -430,7 +430,7 @@ gg_label <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_line.R b/R/gg_line.R index 6a54141b2..916861332 100644 --- a/R/gg_line.R +++ b/R/gg_line.R @@ -410,7 +410,7 @@ gg_line <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_linerange.R b/R/gg_linerange.R index 4f2937e08..0b8c2bc43 100644 --- a/R/gg_linerange.R +++ b/R/gg_linerange.R @@ -498,7 +498,7 @@ gg_linerange <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_path.R b/R/gg_path.R index 39816c16e..156570888 100644 --- a/R/gg_path.R +++ b/R/gg_path.R @@ -414,7 +414,7 @@ gg_path <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_point.R b/R/gg_point.R index 16ad7acc0..d3900d247 100644 --- a/R/gg_point.R +++ b/R/gg_point.R @@ -414,7 +414,7 @@ gg_point <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_pointrange.R b/R/gg_pointrange.R index e09986f67..a3bbf8a0e 100644 --- a/R/gg_pointrange.R +++ b/R/gg_pointrange.R @@ -501,7 +501,7 @@ gg_pointrange <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_polygon.R b/R/gg_polygon.R index 2706074e5..b2527e940 100644 --- a/R/gg_polygon.R +++ b/R/gg_polygon.R @@ -439,7 +439,7 @@ gg_polygon <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_qq.R b/R/gg_qq.R index 91af3dfb4..80e44b947 100644 --- a/R/gg_qq.R +++ b/R/gg_qq.R @@ -427,7 +427,7 @@ gg_qq <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_raster.R b/R/gg_raster.R index 3e440925b..a87ee57e1 100644 --- a/R/gg_raster.R +++ b/R/gg_raster.R @@ -408,7 +408,7 @@ gg_raster <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_rect.R b/R/gg_rect.R index 5dc514bc8..539b711c3 100644 --- a/R/gg_rect.R +++ b/R/gg_rect.R @@ -489,7 +489,7 @@ gg_rect <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_ribbon.R b/R/gg_ribbon.R index db1c05a01..a966778ab 100644 --- a/R/gg_ribbon.R +++ b/R/gg_ribbon.R @@ -84,10 +84,10 @@ #' x = year, #' ymin = level_min, #' ymax = level_max, -#' pal = scales::alpha("#1B9E77", 0), +#' pal = scales::alpha("steelblue4", 0), #' y_title = "Level" #' ) + -#' geom_line(aes(x = year, y = level), col = "#1B9E77") +#' geom_line(aes(x = year, y = level), col = "steelblue4") #' gg_ribbon <- function( data = NULL, @@ -496,7 +496,7 @@ gg_ribbon <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_segment.R b/R/gg_segment.R index 278de11bb..8bc8bc658 100644 --- a/R/gg_segment.R +++ b/R/gg_segment.R @@ -468,7 +468,7 @@ gg_segment <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_sf.R b/R/gg_sf.R index eefff8478..2e816e939 100644 --- a/R/gg_sf.R +++ b/R/gg_sf.R @@ -318,7 +318,7 @@ gg_sf <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_smooth.R b/R/gg_smooth.R index 4bf5435c9..a47479d33 100644 --- a/R/gg_smooth.R +++ b/R/gg_smooth.R @@ -412,7 +412,7 @@ gg_smooth <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_step.R b/R/gg_step.R index cdcf11b8c..8173ec138 100644 --- a/R/gg_step.R +++ b/R/gg_step.R @@ -413,7 +413,7 @@ gg_step <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_text.R b/R/gg_text.R index 3fa83d90f..8a3d87881 100644 --- a/R/gg_text.R +++ b/R/gg_text.R @@ -86,7 +86,7 @@ #' label = model, #' size = 3.53, #' y_include = c(min(.$mpg) * 0.95, max(.$mpg) * 1.05), -#' pal = c("firebrick", "white", "steelblue"), +#' pal = c(guardian()[2], "white", "#36648b"), #' y_title = "Miles per gallon" #' ) #' @@ -431,7 +431,7 @@ gg_text <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_tile.R b/R/gg_tile.R index c0b755a85..d60abf121 100644 --- a/R/gg_tile.R +++ b/R/gg_tile.R @@ -414,7 +414,7 @@ gg_tile <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/R/gg_violin.R b/R/gg_violin.R index c0fda0779..4e095cd32 100644 --- a/R/gg_violin.R +++ b/R/gg_violin.R @@ -414,7 +414,7 @@ gg_violin <- function( } if (!col_scale) { - if (rlang::is_null(pal)) pal <- "#4682b4" + if (rlang::is_null(pal)) pal <- "#36648b" else pal <- as.vector(pal[1]) plot <- plot + diff --git a/man/gg_label.Rd b/man/gg_label.Rd index 74b79721b..78a685fca 100644 --- a/man/gg_label.Rd +++ b/man/gg_label.Rd @@ -227,7 +227,7 @@ bind_rows( label = model, size = 3.53, y_include = c(min(.$mpg) * 0.95, max(.$mpg) * 1.05), - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian()[2], "white", "#36648b"), y_title = "Miles per gallon" ) diff --git a/man/gg_ribbon.Rd b/man/gg_ribbon.Rd index d340cd1f7..72e851560 100644 --- a/man/gg_ribbon.Rd +++ b/man/gg_ribbon.Rd @@ -231,9 +231,9 @@ data.frame(year = 1875:1972, level = as.vector(LakeHuron)) |> x = year, ymin = level_min, ymax = level_max, - pal = scales::alpha("#1B9E77", 0), + pal = scales::alpha("steelblue4", 0), y_title = "Level" ) + - geom_line(aes(x = year, y = level), col = "#1B9E77") + geom_line(aes(x = year, y = level), col = "steelblue4") } diff --git a/man/gg_text.Rd b/man/gg_text.Rd index 2594d52db..292577b78 100644 --- a/man/gg_text.Rd +++ b/man/gg_text.Rd @@ -227,7 +227,7 @@ bind_rows( label = model, size = 3.53, y_include = c(min(.$mpg) * 0.95, max(.$mpg) * 1.05), - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian()[2], "white", "#36648b"), y_title = "Miles per gallon" ) diff --git a/vignettes/articles/1_functions_demo-Rmd.Rmd b/vignettes/articles/1_functions_demo-Rmd.Rmd index ad6da1bef..78e90d9f8 100644 --- a/vignettes/articles/1_functions_demo-Rmd.Rmd +++ b/vignettes/articles/1_functions_demo-Rmd.Rmd @@ -261,7 +261,7 @@ bind_rows( label = model, size = 3.53, y_include = 0, - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian(n = 2)[2], "white", guardian(n = 1)), y_title = "Miles per gallon") ``` @@ -419,9 +419,9 @@ data.frame(year = 1875:1972, level = as.vector(LakeHuron)) |> x = year, ymin = level_min, ymax = level_max, - pal = scales::alpha("steelblue", 0), + pal = scales::alpha("steelblue4", 0), y_title = "Level") + - geom_line(aes(x = year, y = level), col = "steelblue") + geom_line(aes(x = year, y = level), col = "steelblue4") ``` ### gg_segment @@ -442,8 +442,7 @@ if (requireNamespace("sf", quietly = TRUE)) { nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) nc |> - gg_sf( - col = AREA) + gg_sf(col = AREA) } ``` @@ -484,7 +483,7 @@ bind_rows( label = model, size = 3.53, y_include = 0, - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian(n = 2)[2], "white", guardian(n = 1)), y_title = "Miles per gallon") ``` diff --git a/vignettes/articles/2_functions_demo_dark-Rmd.Rmd b/vignettes/articles/2_functions_demo_dark-Rmd.Rmd index 5473b062d..3baf6ef8c 100644 --- a/vignettes/articles/2_functions_demo_dark-Rmd.Rmd +++ b/vignettes/articles/2_functions_demo_dark-Rmd.Rmd @@ -267,7 +267,7 @@ bind_rows( label = model, size = 3.53, y_include = 0, - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian(n = 2)[2], "white", guardian(n = 1)), y_title = "Miles per gallon") ``` @@ -426,9 +426,9 @@ data.frame(year = 1875:1972, level = as.vector(LakeHuron)) |> x = year, ymin = level_min, ymax = level_max, - pal = scales::alpha("steelblue", 0), + pal = scales::alpha("steelblue4", 0), y_title = "Level") + - geom_line(aes(x = year, y = level), col = "steelblue") + geom_line(aes(x = year, y = level), col = "steelblue4") ``` ### gg_segment @@ -449,8 +449,8 @@ if (requireNamespace("sf", quietly = TRUE)) { nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) nc |> - gg_sf( - col = AREA) + gg_sf(col = AREA, + pal = viridis::mako(9)) } ``` @@ -491,7 +491,7 @@ bind_rows( label = model, size = 3.53, y_include = 0, - pal = c("firebrick", "white", "steelblue"), + pal = c(guardian(n = 2)[2], "white", guardian(n = 1)), y_title = "Miles per gallon") ``` diff --git a/vignettes/articles/3_go_further-Rmd.Rmd b/vignettes/articles/3_go_further-Rmd.Rmd index e311c7988..53699ee4b 100644 --- a/vignettes/articles/3_go_further-Rmd.Rmd +++ b/vignettes/articles/3_go_further-Rmd.Rmd @@ -127,7 +127,7 @@ p3 <- iris |> p4 <- iris |> gg_density( x = Sepal.Length, - pal = scales::alpha("steelblue", 0), + pal = scales::alpha("steelblue4", 0), y_labels = \(x) str_keep_seq(x, drop0trailing = TRUE)) (p1 + p2) / (p3 + p4) @@ -143,7 +143,7 @@ p1 <- iris |> x = Sepal.Length, col = 1, stat = "density", - pal = "steelblue", + pal = "steelblue4", colour = "black", y_labels = \(x) str_keep_seq(x, drop0trailing = TRUE), col_legend_place = "n", @@ -155,7 +155,7 @@ p2 <- iris |> x = Sepal.Length, col = 1, stat = "density", - pal = "steelblue", + pal = "steelblue4", fill = "lightgrey", y_labels = \(x) str_keep_seq(x, drop0trailing = TRUE), col_legend_place = "n") diff --git a/vignettes/articles/4_extensions-Rmd.Rmd b/vignettes/articles/4_extensions-Rmd.Rmd index dba58b8c0..c1d0c57b0 100644 --- a/vignettes/articles/4_extensions-Rmd.Rmd +++ b/vignettes/articles/4_extensions-Rmd.Rmd @@ -79,7 +79,7 @@ The ggbeeswarm package can be used to create scatter plots that avoid overlappin penguins2 |> gg_blank(x = species, y = body_mass_g) + - ggbeeswarm::geom_quasirandom(colour = "steelblue") + ggbeeswarm::geom_quasirandom(colour = "steelblue4") ``` #### ggblend @@ -191,8 +191,8 @@ d |> y_title = "") + ggdist::stat_slabinterval( aes(dist = dist), - colour = "steelblue", - fill = scales::alpha("steelblue", 0.5)) + colour = "steelblue4", + fill = scales::alpha("steelblue4", 0.5)) ``` ```{r} @@ -249,7 +249,7 @@ ggplot2::economics |> y = unemploy, alpha = 0.25, y_title = "Unemployment") + - ggforce::geom_bspline(n = 1000, colour = "steelblue") + ggforce::geom_bspline(n = 1000, colour = "steelblue4") ``` #### ggh4x @@ -288,7 +288,7 @@ iris |> col = Species, facet = Species, facet_labels = \(x) str_to_sentence(x), - pal = rep("steelblue", 3) + pal = rep("steelblue4", 3) ) + gghighlight::gghighlight() + scale_y_continuous(expand = c(0, 0)) @@ -323,17 +323,16 @@ library(ggpattern) penguins2 |> group_by(species, sex) |> summarise(across(body_mass_g, \(x) mean(x))) |> - gg_blank(x = body_mass_g, - y = species, + gg_blank(y = body_mass_g, + x = species, col = sex, - position = "dodge", - x_include = 0) + + y_include = 0) + geom_col_pattern(aes(pattern = sex), position = "dodge", alpha = 0.9, width = 0.75) + - guides(pattern = guide_legend(reverse = TRUE)) + #same direction the col scale - labs(pattern = "Sex") #name same as the col_title + labs(pattern = "Sex") + + coord_flip() ``` #### ggpointdensity @@ -446,7 +445,7 @@ p1 <- pressure |> gg_blank(x = temperature, y = pressure) + geom_textline( label = "Mercury vapor pressure increases with temperature", - size = 3.53, vjust = -0.5, hjust = 0.9, color = "steelblue", linecolor = "steelblue") + size = 3.53, vjust = -0.5, hjust = 0.9, color = "steelblue4", linecolor = "steelblue4") p2 <- expand.grid(x = 1:nrow(volcano), y = 1:ncol(volcano)) |> mutate(z = c(volcano)) |> @@ -479,8 +478,8 @@ p <- diamonds |> aes(tooltip = after_stat(count), data_id = color), width = 0.75, - col = "steelblue", - fill = "steelblue", + col = "steelblue4", + fill = "steelblue4", alpha = 0.9) ggiraph::girafe( diff --git a/vignettes/ggblanket.Rmd b/vignettes/ggblanket.Rmd index adf553a18..f3f0da3cf 100644 --- a/vignettes/ggblanket.Rmd +++ b/vignettes/ggblanket.Rmd @@ -480,8 +480,6 @@ p1 <- d |> width = 0.1) + coord_flip() -p1 - p2 <- d |> gg_col( x = species, @@ -499,8 +497,6 @@ p2 <- d |> coord_flip() p1 / p2 - - ``` ### 12. Other key differences to ggplot2 @@ -602,9 +598,9 @@ p1 + p2 ggblanket uses different defaults for colouring. The default `pal` is: -* `steelblue` for where there is no `col` variable -* `ggblanket::guardian` for a discrete `col` variable with 3 or less levels (or unique values if a character). Testing suggests this is safe for colour blindness. -* `scales::hue_pal` for a discrete `col` variable with more than 5 levels (or unique values if not ordered). +* `"steelblue4"` for where there is no `col` variable +* `ggblanket::guardian` for a discrete `col` variable with 4 or less levels (or unique values if a character). This palette is colourblind safe. +* `scales::hue_pal` for a discrete `col` variable with 5 or more levels (or unique values if not ordered). * `viridis::mako` reversed for a continuous `col` variable ggblanket uses different `alpha` defaults for the different `gg_*` functions. Polygons that generally have no gap or overlap default to 1: `gg_bin_2d`, `gg_contour_filled`, `gg_density_2d_filled`, `gg_hex` - as well as `gg_sf` for polygons with a `col` aesthetic. Polygons that generally overlap default to 0.5: `gg_density`. Polygons that generally have key lines within them also default to 0.5: `gg_boxplot`, `gg_crossbar`, `gg_ribbon` and `gg_smooth`. `gg_label` defaults to 0.05. `gg_blank` has no alpha argument. Other polygons default to 0.9: `gg_area`, `gg_bar`, `gg_col`, `gg_histogram`, `gg_polygon`, `gg_rect`, `gg_tile` and `gg_violin`. For all other contexts, alpha defaults to 1. @@ -626,9 +622,9 @@ p1 <- economics |> title = "No x_limits set", theme = light_mode(title_face = "plain")) + geom_vline(xintercept = c(lubridate::ymd("1985-01-01", "1995-01-01")), - col = "steelblue", + col = guardian(n = 1), linetype = 3) + - geom_point(col = "steelblue", alpha = 0.05) + geom_point(col = guardian(n = 1), alpha = 0.05) p2 <- economics |> gg_smooth( @@ -639,7 +635,7 @@ p2 <- economics |> y_labels = \(x) str_keep_seq(x), title = "x_limits set", theme = light_mode(title_face = "plain")) + - geom_point(col = "steelblue", alpha = 0.1) + geom_point(col = guardian(n = 1), alpha = 0.1) p3 <- economics |> gg_smooth( @@ -651,7 +647,7 @@ p3 <- economics |> coord = coord_cartesian(clip = "on"), title = "x_limits set & cartesian space clipped", theme = light_mode(title_face = "plain")) + - geom_point(col = "steelblue", alpha = 0.1) + geom_point(col = guardian(n = 1), alpha = 0.1) p4 <- economics |> gg_smooth( @@ -663,7 +659,7 @@ p4 <- economics |> y_labels = \(x) str_keep_seq(x), title = "x_limits set & x_oob censored", theme = light_mode(title_face = "plain")) + - geom_point(col = "steelblue", alpha = 0.1) + geom_point(col = guardian(n = 1), alpha = 0.1) p5 <- economics |> filter(between(date, lubridate::ymd("1985-01-01"), lubridate::ymd("1995-01-01"))) |> @@ -674,7 +670,7 @@ p5 <- economics |> y_labels = \(x) str_keep_seq(x), title = "x data filtered", theme = light_mode(title_face = "plain")) + - geom_point(col = "steelblue", alpha = 0.1) + geom_point(col = guardian(n = 1), alpha = 0.1) p1 / (p2 + p3) / (p4 + p5) ```