diff --git a/R/theme-defaults.R b/R/theme-defaults.R
index 7b5bb286f7..78946d028e 100644
--- a/R/theme-defaults.R
+++ b/R/theme-defaults.R
@@ -11,7 +11,7 @@
#' legend titles, the plot title and tag text.
#' @param base_line_size base size for line elements
#' @param base_rect_size base size for rect elements
-#' @param ink,paper colour for foreground and background elements respectively.
+#' @param ink,paper,accent colour for foreground, background, and accented elements respectively.
#'
#' @details
#' \describe{
@@ -108,7 +108,7 @@ theme_grey <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
# The half-line (base-fontsize / 2) sets up the basic vertical
# rhythm of the theme. Most margins will be set to this value.
@@ -157,7 +157,7 @@ theme_grey <- function(base_size = 11, base_family = "",
),
geom = element_geom(
- ink = ink, paper = paper, accent = "#3366FF",
+ ink = ink, paper = paper, accent = accent,
linewidth = base_line_size, borderwidth = base_line_size,
linetype = 1L, bordertype = 1L,
family = base_family, fontsize = base_size,
@@ -288,7 +288,7 @@ theme_bw <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
# Starts with theme_grey and then modify some parts
theme_grey(
base_size = base_size,
@@ -296,7 +296,7 @@ theme_bw <- function(base_size = 11, base_family = "",
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
# white background and dark border
@@ -321,7 +321,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
half_line <- base_size / 2
# Starts with theme_bw and then modify some parts
@@ -332,7 +332,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
# black text and ticks on the axes
@@ -365,7 +365,7 @@ theme_light <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
half_line <- base_size / 2
# Starts with theme_grey and then modify some parts
@@ -375,7 +375,7 @@ theme_light <- function(base_size = 11, base_family = "",
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
# white panel with light grey border
@@ -409,7 +409,7 @@ theme_dark <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
half_line <- base_size / 2
# Starts with theme_grey and then modify some parts
@@ -419,7 +419,7 @@ theme_dark <- function(base_size = 11, base_family = "",
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
# dark panel
@@ -451,7 +451,7 @@ theme_minimal <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
# Starts with theme_bw and remove most parts
theme_bw(
base_size = base_size,
@@ -459,7 +459,7 @@ theme_minimal <- function(base_size = 11, base_family = "",
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
axis.ticks = element_blank(), # Extra margins due to absence ticks
@@ -484,14 +484,14 @@ theme_classic <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
theme_bw(
base_size = base_size,
base_family = base_family,
header_family = header_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size,
- ink = ink, paper = paper
+ ink = ink, paper = paper, accent = accent
) %+replace%
theme(
# no background and no grid
@@ -517,7 +517,7 @@ theme_void <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = alpha(ink, 0)) {
+ ink = "black", paper = alpha(ink, 0), accent = "#3366FF") {
half_line <- base_size / 2
# Only keep indispensable text: legend and plot titles
@@ -538,6 +538,13 @@ theme_void <- function(base_size = 11, base_family = "",
title = element_text(family = header_family),
spacing = unit(half_line, "pt"),
margins = margin_auto(half_line),
+ geom = element_geom(
+ ink = ink, paper = paper, accent = accent,
+ linewidth = base_line_size, borderwidth = base_line_size,
+ linetype = 1L, bordertype = 1L,
+ family = base_family, fontsize = base_size,
+ pointsize = (base_size / 11) * 1.5, pointshape = 19
+ ),
axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks.length = rel(0),
@@ -608,7 +615,7 @@ theme_test <- function(base_size = 11, base_family = "",
header_family = NULL,
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
- ink = "black", paper = "white") {
+ ink = "black", paper = "white", accent = "#3366FF") {
half_line <- base_size / 2
t <- theme(
@@ -639,7 +646,7 @@ theme_test <- function(base_size = 11, base_family = "",
spacing = unit(half_line, "pt"),
margins = margin_auto(half_line),
geom = element_geom(
- ink = ink, paper = paper, accent = "#3366FF",
+ ink = ink, paper = paper, accent = accent,
linewidth = base_line_size, borderwidth = base_line_size,
family = base_family, fontsize = base_size,
linetype = 1L,
diff --git a/ggplot2.Rproj b/ggplot2.Rproj
index 5215454023..30db3b4433 100644
--- a/ggplot2.Rproj
+++ b/ggplot2.Rproj
@@ -1,5 +1,4 @@
Version: 1.0
-ProjectId: f500cb87-e0be-413f-b396-3eb022932f55
RestoreWorkspace: Default
SaveWorkspace: Default
diff --git a/man/ggplot2-ggproto.Rd b/man/ggplot2-ggproto.Rd
index dcd57c12a1..8fb7630c22 100644
--- a/man/ggplot2-ggproto.Rd
+++ b/man/ggplot2-ggproto.Rd
@@ -324,7 +324,7 @@ return an empty grob for each panel.
\item \code{draw_front}: As above except the returned grob is placed
between the layer stack and the foreground defined by the Coord object
(usually empty). The default is, as above, to return an empty grob.
-\item \code{draw_facet_panels}: Draws each panel for the facet. Should return a list
+\item \code{draw_panel_content}: Draws each panel for the facet. Should return a list
of grobs, one for each panel. The output is used by the \code{draw_panels}
method.
\item \code{draw_labels}: Given the gtable returned by \code{draw_panels},
diff --git a/man/ggtheme.Rd b/man/ggtheme.Rd
index c306fef405..4a0af1e354 100644
--- a/man/ggtheme.Rd
+++ b/man/ggtheme.Rd
@@ -20,7 +20,8 @@ theme_grey(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_gray(
@@ -30,7 +31,8 @@ theme_gray(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_bw(
@@ -40,7 +42,8 @@ theme_bw(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_linedraw(
@@ -50,7 +53,8 @@ theme_linedraw(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_light(
@@ -60,7 +64,8 @@ theme_light(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_dark(
@@ -70,7 +75,8 @@ theme_dark(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_minimal(
@@ -80,7 +86,8 @@ theme_minimal(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_classic(
@@ -90,7 +97,8 @@ theme_classic(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
theme_void(
@@ -100,7 +108,8 @@ theme_void(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = alpha(ink, 0)
+ paper = alpha(ink, 0),
+ accent = "#3366FF"
)
theme_test(
@@ -110,7 +119,8 @@ theme_test(
base_line_size = base_size/22,
base_rect_size = base_size/22,
ink = "black",
- paper = "white"
+ paper = "white",
+ accent = "#3366FF"
)
}
\arguments{
@@ -126,7 +136,7 @@ legend titles, the plot title and tag text.}
\item{base_rect_size}{base size for rect elements}
-\item{ink, paper}{colour for foreground and background elements respectively.}
+\item{ink, paper, accent}{colour for foreground, background, and accented elements respectively.}
}
\description{
These are complete themes which control all non-data display. Use
diff --git a/tests/testthat/_snaps/theme/theme-void-large.svg b/tests/testthat/_snaps/theme/theme-void-large.svg
index 58ac3525dd..b4887d1aff 100644
--- a/tests/testthat/_snaps/theme/theme-void-large.svg
+++ b/tests/testthat/_snaps/theme/theme-void-large.svg
@@ -26,9 +26,9 @@
-
-
-
+
+
+
@@ -42,8 +42,8 @@
z
-
-
+
+
a
b
theme_void_large