Skip to content

Commit a583f0e

Browse files
authored
add new examples (#6442)
1 parent 6cad87d commit a583f0e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

R/theme.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,21 @@
319319
#' # as in the facet_wrap the default strip.position is "top"
320320
#' p3 + theme(strip.text.x.top = element_text(colour = "white", face = "bold"))
321321
#' p3 + theme(panel.spacing = unit(1, "lines"))
322+
#'
323+
#' # Colours -------------------------------------------------------------------
324+
#'
325+
#' p4 <- ggplot(mtcars, aes(wt, mpg)) +
326+
#' geom_point() +
327+
#' annotate(label = "Text Annotation", x = 5, y = 30, geom = "text")
328+
#'
329+
#' # You can use the 'ink' setting to set colour defaults for all layers
330+
#' p4 + theme(geom = element_geom(ink = "dodgerblue"))
331+
#' # Alternate colours are derived from the 'accent' and 'paper' settings
332+
#' p4 + geom_smooth(method = "lm", formula = y ~ x) +
333+
#' theme(geom = element_geom(accent = "tomato", paper = "orchid"))
334+
#' # You can also set default palettes in the theme
335+
#' p4 + aes(colour = drat) +
336+
#' theme(palette.colour.continuous = c("white", "pink", "hotpink"))
322337
#' }
323338
theme <- function(...,
324339
line,

man/theme.Rd

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)