Skip to content

Commit 19b1fdf

Browse files
committed
New theme_void(), completely empty
1 parent c383670 commit 19b1fdf

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ export(theme_segment)
409409
export(theme_set)
410410
export(theme_text)
411411
export(theme_update)
412+
export(theme_void)
412413
export(update_element)
413414
export(update_geom_defaults)
414415
export(update_labels)

R/theme-defaults.r

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#' \item{\code{theme_classic}}{
3333
#' A classic-looking theme, with x and y axis lines and no gridlines.}
3434
#'
35+
#' \item{\code{theme_void}}{
36+
#' A completely empty theme.}
37+
#'
3538
#' }
3639
#'
3740
#' @examples
@@ -45,6 +48,7 @@
4548
#' p + theme_light()
4649
#' p + theme_minimal()
4750
#' p + theme_classic()
51+
#' p + theme_void()
4852
#'
4953
#' @name ggtheme
5054
NULL
@@ -194,3 +198,18 @@ theme_classic <- function(base_size = 12, base_family = ""){
194198
legend.key = element_blank()
195199
)
196200
}
201+
202+
#' @export
203+
#' @rdname ggtheme
204+
theme_void <- function(base_size = 12, base_family = "") {
205+
theme(
206+
# Use only inherited elements and make everything blank
207+
line = element_blank(),
208+
rect = element_blank(),
209+
text = element_blank(),
210+
plot.margin = unit(c(0, 0, 0, 0), "lines"),
211+
212+
complete = TRUE
213+
)
214+
}
215+

man/ggtheme.Rd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
\alias{theme_light}
99
\alias{theme_linedraw}
1010
\alias{theme_minimal}
11+
\alias{theme_void}
1112
\title{ggplot2 themes}
1213
\usage{
1314
theme_grey(base_size = 12, base_family = "")
@@ -23,6 +24,8 @@ theme_light(base_size = 12, base_family = "")
2324
theme_minimal(base_size = 12, base_family = "")
2425

2526
theme_classic(base_size = 12, base_family = "")
27+
28+
theme_void(base_size = 12, base_family = "")
2629
}
2730
\arguments{
2831
\item{base_size}{base font size}
@@ -60,6 +63,9 @@ A minimalistic theme with no background annotations.}
6063
\item{\code{theme_classic}}{
6164
A classic-looking theme, with x and y axis lines and no gridlines.}
6265

66+
\item{\code{theme_void}}{
67+
A completely empty theme.}
68+
6369
}
6470
}
6571
\examples{
@@ -73,5 +79,6 @@ p + theme_linedraw()
7379
p + theme_light()
7480
p + theme_minimal()
7581
p + theme_classic()
82+
p + theme_void()
7683
}
7784

0 commit comments

Comments
 (0)