ggplot_theme: Theme and color scales for 'ggplot2'

Description Usage Arguments Examples

Description

Theme and color scales for ggplot2

Usage

1
2
3
4
5
6
7
theme_editor(theme = NA, base_size = 10, base_family = "sans")

scale_fill_editor(theme = NA, ...)

scale_colour_editor(theme = NA, ...)

scale_color_editor(theme = NA, ...)

Arguments

theme

A string corresponding to one of the 31 themes available in RStudio (see list_pal). If not specified, the function tries to retrieve the active theme using rstudioapi.

base_size

base font size

base_family

base font family

...

Other arguments passed on to discrete_scale to control name, limits, breaks, labels and so forth.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require(ggplot2)

## Not run: 
ggplot(iris, aes(Sepal.Length, Petal.Length, color = Species)) +
  geom_point() +
  labs(title = "Edgar Anderson's Iris Data",
  subtitle = "This is a demo", caption = "This is a caption") +
  theme_editor() +
  scale_color_editor()

ggplot(iris, aes(Sepal.Length, Petal.Length)) +
  geom_point(color = col_fg(fade = 0.2)) +
  geom_smooth(color = get_pal()[1], fill = get_pal()[2]) +
  labs(title = "Edgar Anderson's Iris Data",
  subtitle = "This is a demo", caption = "This is a caption") +
  theme_editor()

ggplot(iris, aes(Sepal.Length, Petal.Length, color = Species)) +
  geom_point() +
  labs(title = "Facet wrap") +
  facet_wrap(~Species) +
  theme_editor() +
  scale_color_editor()

## End(Not run)

for(i in list_pal()){
 p <- ggplot(iris, aes(Sepal.Length, Petal.Length)) +
  geom_point(color = col_fg(i, fade = 0.2)) +
  geom_smooth(color = get_pal(theme = i)[1], fill = get_pal(theme = i)[2]) +
  labs(title = i, caption = "A caption") +
  theme_editor(theme = i) +
  scale_fill_editor(theme = i)
  print(p)
}

fkeck/editheme documentation built on May 29, 2019, 2:34 p.m.