Skip to content

Commit 7808875

Browse files
committed
Add examples to showcase themes
1 parent 3f7fceb commit 7808875

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

R/theme-defaults.r

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ theme_bw <- function(base_size = 12, base_family = "") {
9090
#' @param base_family base font family
9191
#' @export
9292
#' @family themes
93+
#' @examples
94+
#' p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg))
95+
#' p
96+
#' # 'classic' dark-on-light theme
97+
#' p + theme_bw()
98+
#' # this theme
99+
#' p + theme_linedraw()
100+
#' # variation with light box and axes legends
101+
#' p + theme_light()
93102
theme_linedraw <- function(base_size = 12, base_family = "") {
94103
# Starts with theme_grey and then modify some parts
95104
theme_grey(base_size = base_size, base_family = base_family) %+replace%
@@ -113,6 +122,15 @@ theme_linedraw <- function(base_size = 12, base_family = "") {
113122
#' @param base_family base font family
114123
#' @export
115124
#' @family themes
125+
#' @examples
126+
#' p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg))
127+
#' p
128+
#' # 'classic' dark-on-light theme
129+
#' p + theme_bw()
130+
#' # this theme
131+
#' p + theme_light()
132+
#' # variation with dark box and axes legends
133+
#' p + theme_linedraw()
116134
theme_light <- function(base_size = 12, base_family = "") {
117135
# Starts with theme_grey and then modify some parts
118136
theme_grey(base_size = base_size, base_family = base_family) %+replace%

man/theme_light.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ theme_light(base_size = 12, base_family = "")
1313
\description{
1414
A theme with white background and light grey lines
1515
}
16+
\examples{
17+
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg))
18+
p
19+
# 'classic' dark-on-light theme
20+
p + theme_bw()
21+
# this theme
22+
p + theme_light()
23+
# variation with dark box and axes legends
24+
p + theme_linedraw()
25+
}
1626
\seealso{
1727
Other themes: \code{\link{theme_bw}};
1828
\code{\link{theme_classic}}; \code{\link{theme_gray}},

man/theme_linedraw.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ theme_linedraw(base_size = 12, base_family = "")
1313
\description{
1414
A theme with white background and black gridlines.
1515
}
16+
\examples{
17+
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg))
18+
p
19+
# 'classic' dark-on-light theme
20+
p + theme_bw()
21+
# this theme
22+
p + theme_linedraw()
23+
# variation with light box and axes legends
24+
p + theme_light()
25+
}
1626
\seealso{
1727
Other themes: \code{\link{theme_bw}};
1828
\code{\link{theme_classic}}; \code{\link{theme_gray}},

0 commit comments

Comments
 (0)