Skip to content

New examples for theme_*() #2721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions R/theme-defaults.r
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,45 @@
#' }
#'
#' @examples
#' p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
#' colour = factor(gear))) + facet_wrap(~am)
#' p + theme_gray() # the default
#' p + theme_bw()
#' p + theme_linedraw()
#' p + theme_light()
#' p + theme_dark()
#' p + theme_minimal()
#' p + theme_classic()
#' p + theme_void()
#' mtcars2 <- within(mtcars, {
#' vs <- factor(vs, labels = c("V-shaped", "Straight"))
#' am <- factor(am, labels = c("Automatic", "Manual"))
#' cyl <- factor(cyl)
#' gear <- factor(gear)
#' })
#'
#' p1 <- ggplot(mtcars2) +
#' geom_point(aes(x = wt, y = mpg, colour = gear)) +
#' labs(title = "Fuel economy declines as weight increases",
#' subtitle = "(1973-74)",
#' caption = "Data from the 1974 Motor Trend US magazine.",
#' tag = "Figure 1",
#' x = "Weight (1000 lbs)",
#' y = "Fuel economy (mpg)",
#' colour = "Gears")
#'
#' p1 + theme_gray() # the default
#' p1 + theme_bw()
#' p1 + theme_linedraw()
#' p1 + theme_light()
#' p1 + theme_dark()
#' p1 + theme_minimal()
#' p1 + theme_classic()
#' p1 + theme_void()
#'
#' # Theme examples with panels
#' \donttest{
#' p2 <- p1 + facet_grid(vs ~ am)
#'
#' p2 + theme_gray() # the default
#' p2 + theme_bw()
#' p2 + theme_linedraw()
#' p2 + theme_light()
#' p2 + theme_dark()
#' p2 + theme_minimal()
#' p2 + theme_classic()
#' p2 + theme_void()
#' }
#' @name ggtheme
#' @aliases NULL
NULL
Expand Down