diff --git a/NEWS.md b/NEWS.md
index fc76c1a6b..a82d23da6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,6 @@
# ggblanket 11.0.0.9000
-* Rethought `set_blanket` and `weave_geom_defaults` arguments.
+* In `set_blanket`, renamed `reference_line_*` arguments to `reference_*`.
* Added R 4.2.0 dependency.
* Removed `aes_colour_darken`, `aes_colour_lighten`, `aes_fill_darken` and `aes_colour_lighten`.
* Removed `gg_ribbon`, `gg_boxplot`, `gg_crossbar` and `gg_smooth` alpha default to `NA`.
diff --git a/R/set_blanket.R b/R/set_blanket.R
index 2337a1f2e..26f3704df 100644
--- a/R/set_blanket.R
+++ b/R/set_blanket.R
@@ -13,19 +13,13 @@
#'
#' @param ... Provided to force user argument naming etc.
#' @param mode A ggplot2 theme (e.g. [light_mode_t()] or [dark_mode_r()]) that anticipates `gg_*` side-effects of removing relevant axis line/ticks and gridlines per the `mode_orientation`.
-#' @param colour A default hex colour for the colour of geoms.
-#' @param colour_text A default hex colour for the colour of the "text" geom.
-#' @param colour_label A default hex colour for the colour of the "label" geom.
-#' @param colour_hline A default hex colour for the colour of the "hline" geom.
-#' @param colour_vline A default hex colour for the colour of the vline" geom.
-#' @param fill A default hex colour for the fill of geoms.
-#' @param fill_label A default hex colour for the fill of the "label" geom.
-#' @param size_text A default size for the "text" geom.
-#' @param size_label A default size for the label" geom.
-#' @param family_text A default family for the "text" geom.
-#' @param family_label A default family for the "label" geom.
-#' @param linewidth_hline A default hex colour for the colour of the "hline" geom.
-#' @param linewidth_vline A default hex colour for the colour of the "vline" geom.
+#' @param colour A default hex colour for the colour of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).
+#' @param fill A default hex colour for the fill of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).
+#' @param text_colour A default hex colour for the colour of the "text" and "label" geoms.
+#' @param text_size A default size for the "text" and "label" geoms.
+#' @param text_family A default family for the "text" and "label" geoms.
+#' @param reference_colour A default hex colour for the colour of the "hline", "vline" and "abline" geoms.
+#' @param reference_linewidth A default hex colour for the colour of the "hline", "vline" and "abline" geoms.
#' @param col_palette_d For a discrete scale, a character vector of hex codes.
#' @param col_palette_c For a continuous scale, a character vector of hex codes.
#' @param col_palette_o For an ordinal scale, a `scales::pal_*()` function.
@@ -72,18 +66,12 @@ set_blanket <- function(
...,
mode = light_mode_r(),
colour = "#357BA2FF",
- colour_text = "#121B24FF",
- colour_label = "#FFFFFFFF",
- colour_hline = "#121B24FF",
- colour_vline = "#121B24FF",
fill = colour,
- fill_label = "#121B24FF",
- size_text = 11 / 2.835052,
- size_label = size_text,
- family_text = "",
- family_label = family_text,
- linewidth_hline = 0.25,
- linewidth_vline = 0.25,
+ text_colour = "#121B24FF",
+ text_size = 11 / 2.835052,
+ text_family = "",
+ reference_colour = "#121B24FF",
+ reference_linewidth = 0.25,
col_palette_d = jumble,
col_palette_c = viridisLite::mako(n = 9, direction = -1),
col_palette_o = scales::pal_viridis(option = "G", direction = -1),
@@ -96,18 +84,12 @@ set_blanket <- function(
weave_geom_defaults(
colour = colour,
- colour_text = colour_text,
- colour_label = colour_label,
- colour_hline = colour_hline,
- colour_vline = colour_vline,
fill = fill,
- fill_label = fill_label,
- size_text = size_text,
- size_label = size_label,
- family_text = family_text,
- family_label = family_label,
- linewidth_hline = linewidth_hline,
- linewidth_vline = linewidth_vline
+ text_colour = text_colour,
+ text_size = text_size,
+ text_family = text_family,
+ reference_colour = reference_colour,
+ reference_linewidth = reference_linewidth
)
weave_col_palettes(
diff --git a/R/weave.R b/R/weave.R
index 890f25cc8..45b72becd 100644
--- a/R/weave.R
+++ b/R/weave.R
@@ -29,35 +29,23 @@ weave_mode <- function(mode = light_mode_r()) {
#'
#' [ggplot2::update_geom_defaults()] can be used to further fine-tune individual geom defaults.
#'
-#' @param colour A default hex colour for the colour of geoms.
-#' @param colour_text A default hex colour for the colour of the "text" geom.
-#' @param colour_label A default hex colour for the colour of the "label" geom.
-#' @param colour_hline A default hex colour for the colour of the "hline" geom.
-#' @param colour_vline A default hex colour for the colour of the vline" geom.
-#' @param fill A default hex colour for the fill of geoms.
-#' @param fill_label A default hex colour for the fill of the "label" geom.
-#' @param size_text A default size for the "text" geom.
-#' @param size_label A default size for the label" geom.
-#' @param family_text A default family for the "text" geom.
-#' @param family_label A default family for the "label" geom.
-#' @param linewidth_hline A default hex colour for the colour of the "hline" geom.
-#' @param linewidth_vline A default hex colour for the colour of the "vline" geom.
+#' @param colour A default hex colour for the colour of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).
+#' @param fill A default hex colour for the fill of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).
+#' @param text_colour A default hex colour for the colour of the "text" and "label" geoms.
+#' @param text_size A default size for the "text" and "label" geoms.
+#' @param text_family A default family for the "text" and "label" geoms.
+#' @param reference_colour A default hex colour for the colour of the "hline", "vline" and "abline" geoms.
+#' @param reference_linewidth A default hex colour for the colour of the "hline", "vline" and "abline" geoms.
#'
#' @export
weave_geom_defaults <- function(
colour = "#357BA2FF",
- colour_text = "#121B24FF",
- colour_label = "#FFFFFFFF",
- colour_hline = "#121B24FF",
- colour_vline = "#121B24FF",
fill = colour,
- fill_label = "#121B24FF",
- size_text = 11 / 2.835052,
- size_label = 11 / 2.835052,
- family_text = "",
- family_label = "",
- linewidth_hline = 0.25,
- linewidth_vline = 0.25
+ text_colour = "#121B24FF",
+ text_size = 11 / 2.835052,
+ text_family = "",
+ reference_colour = "#121B24FF",
+ reference_linewidth = 0.25
) {
#polygons
@@ -83,7 +71,6 @@ weave_geom_defaults <- function(
ggplot2::update_geom_defaults("hex", ggplot2::aes(fill = !!fill, linewidth = 0))
#lines
- ggplot2::update_geom_defaults("abline", ggplot2::aes(colour = !!colour, linewidth = 0.66))
ggplot2::update_geom_defaults("contour", ggplot2::aes(colour = !!colour, linewidth = 0.66))
ggplot2::update_geom_defaults("curve", ggplot2::aes(colour = !!colour, linewidth = 0.66))
ggplot2::update_geom_defaults("density2d", ggplot2::aes(colour = !!colour, linewidth = 0.66))
@@ -103,12 +90,13 @@ weave_geom_defaults <- function(
ggplot2::update_geom_defaults("pointrange", ggplot2::aes(colour = !!colour, fill = !!fill, linewidth = 0.66, size = 0.2)) # 1.5 / 7.5
#hline & vline
- ggplot2::update_geom_defaults("hline", ggplot2::aes(colour = !!colour_hline, linewidth = !!linewidth_hline))
- ggplot2::update_geom_defaults("vline", ggplot2::aes(colour = !!colour_vline, linewidth = !!linewidth_vline))
+ ggplot2::update_geom_defaults("abline", ggplot2::aes(colour = !!reference_colour, linewidth = !!reference_linewidth))
+ ggplot2::update_geom_defaults("hline", ggplot2::aes(colour = !!reference_colour, linewidth = !!reference_linewidth))
+ ggplot2::update_geom_defaults("vline", ggplot2::aes(colour = !!reference_colour, linewidth = !!reference_linewidth))
#text and label
- ggplot2::update_geom_defaults("text", ggplot2::aes(colour = !!colour_text, size = !!size_text, family = !!family_text))
- ggplot2::update_geom_defaults("label", ggplot2::aes(colour = !!colour_label, fill = !!fill_label, size = !!size_label, family = !!family_label))
+ ggplot2::update_geom_defaults("text", ggplot2::aes(colour = !!text_colour, size = !!text_size, family = !!text_family))
+ ggplot2::update_geom_defaults("label", ggplot2::aes(colour = !!text_colour, size = !!text_size, family = !!text_family))
}
#' Set a discrete colour and fill palettes
diff --git a/man/set_blanket.Rd b/man/set_blanket.Rd
index 7d85e1e83..41054bb9d 100644
--- a/man/set_blanket.Rd
+++ b/man/set_blanket.Rd
@@ -8,18 +8,12 @@ set_blanket(
...,
mode = light_mode_r(),
colour = "#357BA2FF",
- colour_text = "#121B24FF",
- colour_label = "#FFFFFFFF",
- colour_hline = "#121B24FF",
- colour_vline = "#121B24FF",
fill = colour,
- fill_label = "#121B24FF",
- size_text = 11/2.835052,
- size_label = size_text,
- family_text = "",
- family_label = family_text,
- linewidth_hline = 0.25,
- linewidth_vline = 0.25,
+ text_colour = "#121B24FF",
+ text_size = 11/2.835052,
+ text_family = "",
+ reference_colour = "#121B24FF",
+ reference_linewidth = 0.25,
col_palette_d = jumble,
col_palette_c = viridisLite::mako(n = 9, direction = -1),
col_palette_o = scales::pal_viridis(option = "G", direction = -1),
@@ -34,31 +28,19 @@ set_blanket(
\item{mode}{A ggplot2 theme (e.g. \code{\link[=light_mode_t]{light_mode_t()}} or \code{\link[=dark_mode_r]{dark_mode_r()}}) that anticipates \verb{gg_*} side-effects of removing relevant axis line/ticks and gridlines per the \code{mode_orientation}.}
-\item{colour}{A default hex colour for the colour of geoms.}
+\item{colour}{A default hex colour for the colour of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).}
-\item{colour_text}{A default hex colour for the colour of the "text" geom.}
+\item{fill}{A default hex colour for the fill of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).}
-\item{colour_label}{A default hex colour for the colour of the "label" geom.}
+\item{text_colour}{A default hex colour for the colour of the "text" and "label" geoms.}
-\item{colour_hline}{A default hex colour for the colour of the "hline" geom.}
+\item{text_size}{A default size for the "text" and "label" geoms.}
-\item{colour_vline}{A default hex colour for the colour of the vline" geom.}
+\item{text_family}{A default family for the "text" and "label" geoms.}
-\item{fill}{A default hex colour for the fill of geoms.}
+\item{reference_colour}{A default hex colour for the colour of the "hline", "vline" and "abline" geoms.}
-\item{fill_label}{A default hex colour for the fill of the "label" geom.}
-
-\item{size_text}{A default size for the "text" geom.}
-
-\item{size_label}{A default size for the label" geom.}
-
-\item{family_text}{A default family for the "text" geom.}
-
-\item{family_label}{A default family for the "label" geom.}
-
-\item{linewidth_hline}{A default hex colour for the colour of the "hline" geom.}
-
-\item{linewidth_vline}{A default hex colour for the colour of the "vline" geom.}
+\item{reference_linewidth}{A default hex colour for the colour of the "hline", "vline" and "abline" geoms.}
\item{col_palette_d}{For a discrete scale, a character vector of hex codes.}
diff --git a/man/weave_geom_defaults.Rd b/man/weave_geom_defaults.Rd
index 017f234e8..b0bcbe742 100644
--- a/man/weave_geom_defaults.Rd
+++ b/man/weave_geom_defaults.Rd
@@ -6,46 +6,28 @@
\usage{
weave_geom_defaults(
colour = "#357BA2FF",
- colour_text = "#121B24FF",
- colour_label = "#FFFFFFFF",
- colour_hline = "#121B24FF",
- colour_vline = "#121B24FF",
fill = colour,
- fill_label = "#121B24FF",
- size_text = 11/2.835052,
- size_label = 11/2.835052,
- family_text = "",
- family_label = "",
- linewidth_hline = 0.25,
- linewidth_vline = 0.25
+ text_colour = "#121B24FF",
+ text_size = 11/2.835052,
+ text_family = "",
+ reference_colour = "#121B24FF",
+ reference_linewidth = 0.25
)
}
\arguments{
-\item{colour}{A default hex colour for the colour of geoms.}
+\item{colour}{A default hex colour for the colour of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).}
-\item{colour_text}{A default hex colour for the colour of the "text" geom.}
+\item{fill}{A default hex colour for the fill of geoms (other than "text", "label", "hline", "vline" and "abline" geoms).}
-\item{colour_label}{A default hex colour for the colour of the "label" geom.}
+\item{text_colour}{A default hex colour for the colour of the "text" and "label" geoms.}
-\item{colour_hline}{A default hex colour for the colour of the "hline" geom.}
+\item{text_size}{A default size for the "text" and "label" geoms.}
-\item{colour_vline}{A default hex colour for the colour of the vline" geom.}
+\item{text_family}{A default family for the "text" and "label" geoms.}
-\item{fill}{A default hex colour for the fill of geoms.}
+\item{reference_colour}{A default hex colour for the colour of the "hline", "vline" and "abline" geoms.}
-\item{fill_label}{A default hex colour for the fill of the "label" geom.}
-
-\item{size_text}{A default size for the "text" geom.}
-
-\item{size_label}{A default size for the label" geom.}
-
-\item{family_text}{A default family for the "text" geom.}
-
-\item{family_label}{A default family for the "label" geom.}
-
-\item{linewidth_hline}{A default hex colour for the colour of the "hline" geom.}
-
-\item{linewidth_vline}{A default hex colour for the colour of the "vline" geom.}
+\item{reference_linewidth}{A default hex colour for the colour of the "hline", "vline" and "abline" geoms.}
}
\description{
Update all the geom defaults.
diff --git a/tests/testthat/_snaps/article-demo-light/gg-label.svg b/tests/testthat/_snaps/article-demo-light/gg-label.svg
index f57b4b549..ef87aaebf 100644
--- a/tests/testthat/_snaps/article-demo-light/gg-label.svg
+++ b/tests/testthat/_snaps/article-demo-light/gg-label.svg
@@ -31,12 +31,12 @@
-
-Cadillac Fleetwood
-
-Lincoln Continental
-
-Toyota Corolla
+
+Cadillac Fleetwood
+
+Lincoln Continental
+
+Toyota Corolla
0
5
diff --git a/tests/testthat/test-article-demo-light.R b/tests/testthat/test-article-demo-light.R
index 85e372fd2..a55a3d442 100644
--- a/tests/testthat/test-article-demo-light.R
+++ b/tests/testthat/test-article-demo-light.R
@@ -302,7 +302,7 @@ test_that(test_name, {
size = 3.53,
y_expand_limits = 0,
y_label = "Miles per gallon",
- col_palette = c(orange, "white", teal),
+ # col_palette = c(orange, "white", teal),
)
vdiffr::expect_doppelganger(test_name, p)
diff --git a/tests/testthat/test-set_blanket.R b/tests/testthat/test-set_blanket.R
index cf5d32a76..d44d2b90d 100644
--- a/tests/testthat/test-set_blanket.R
+++ b/tests/testthat/test-set_blanket.R
@@ -35,8 +35,8 @@ test_that(test_name, {
set_blanket(
mode = light_mode_r(),
colour = red,
- colour_text = teal,
- colour_vline = teal,
+ text_colour = teal,
+ reference_colour = teal,
)
p <- penguins |>
@@ -56,10 +56,10 @@ test_that(test_name, {
set_blanket(
mode = dark_mode_r(base_size = 15),
colour = red,
- colour_text = "red",
- colour_vline = "red",
- linewidth_vline = 5,
- size_text = 15 / 2.83505,
+ text_colour = "red",
+ text_size = 15 / 2.83505,
+ reference_colour = "red",
+ reference_linewidth = 5,
col_palette_d = c(navy, red, "green"),
col_palette_c = c(navy, purple, red, orange)
)
diff --git a/vignettes/articles/2_demo_dark.Rmd b/vignettes/articles/2_demo_dark.Rmd
index e79ed7e45..fee458818 100644
--- a/vignettes/articles/2_demo_dark.Rmd
+++ b/vignettes/articles/2_demo_dark.Rmd
@@ -29,9 +29,8 @@ library(palmerpenguins)
set_blanket(
mode = dark_mode_r(),
- colour_text = darkness[1],
- colour_hline = darkness[1],
- colour_vline = darkness[1],
+ text_colour = darkness[1],
+ reference_colour = darkness[1],
col_palette_d = c(teal, orange, purple, red, pink, navy),
col_palette_c = viridis::mako(n = 9),
col_palette_o = scales::pal_viridis(option = "G"),
diff --git a/vignettes/ggblanket.Rmd b/vignettes/ggblanket.Rmd
index b40172abf..90372c7a1 100644
--- a/vignettes/ggblanket.Rmd
+++ b/vignettes/ggblanket.Rmd
@@ -356,7 +356,7 @@ penguins2 |>
The `set_blanket` function sets customisable defaults for the:
* mode (i.e. a theme added with side-effects).
-* geom defaults (e.g. colour/fill)
+* geom defaults (e.g. colour/fill, and text and reference line defaults.
* discrete colour palette (and NA colour)
* continuous colour palette (and NA colour)
* ordinal colour palette (and NA colour)
@@ -372,9 +372,8 @@ The `ggplot2::update_geom_defaults()` function can be used to further fine-tune
set_blanket(
mode = dark_mode_r(),
colour = "#E7298AFF",
- colour_text = darkness[1],
- colour_hline = darkness[1],
- colour_vline = darkness[1],
+ text_colour = darkness[1],
+ reference_colour = darkness[1],
col_palette_d = c("#1B9E77FF", "#D95F02FF", "#7570b3FF", "#E7298AFF",
"#66A61EFF", "#E6AB02FF", "#A6761DFF", "#666666FF"),
)