themes: Customized ggplot themes

Description Usage Arguments Functions Examples

Description

Customized ggplot themes

Usage

 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
set_aesthetics(font_normal, font_semi, font_light, projector)

theme_blank(legend.position = "none", legend.direction = "horizontal",
  font_normal = "Lato", font_semi = "Lato", font_light = "Lato Light",
  font_legend_title = 12, font_legend_label = font_legend_title * 0.8,
  projector = FALSE, background_colour = NA)

theme_facet(legend.position = "none", legend.direction = "horizontal",
  font_normal = "Lato", font_semi = "Lato", font_light = "Lato Light",
  font_facet = "Lato Light", facet_size = 14, font_legend_title = 12,
  font_legend_label = font_legend_title * 0.8, projector = FALSE,
  background_colour = NA)

theme_stroke(stroke_size = 0.25, stroke_colour = grey90K)

theme_xaxis(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_yaxis(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_xlab(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_ylab(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_xylab(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_xgrid(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_ygrid(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_title = font_axis_label *
  1.3, font_subtitle = font_axis_label * 1.2, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_xygrid(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = "none",
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

theme_basic(font_normal = "Lato", font_semi = "Lato",
  font_light = "Lato Light", legend.position = c(0.85, 0.85),
  legend.direction = "horizontal", panel_spacing = 3,
  font_axis_label = 12, font_axis_title = font_axis_label * 1.15,
  font_facet = font_axis_label * 1.15, font_legend_title = font_axis_label,
  font_legend_label = font_axis_label * 0.8, font_subtitle = font_axis_label
  * 1.2, font_title = font_axis_label * 1.3, grey_background = FALSE,
  background_colour = grey10K, projector = FALSE)

Arguments

font_normal

(optional) string containing font name for normal text

font_semi

(optional) string containing font name for semilight text

font_light

(optional) string containing font name for light text

projector

(optional) if TRUE, make lines and text bolder for an LCD projector

legend.position

(optional) legend position; takes either a ggplot legend position string like ''left'' or a tuple in percent of the x- and y-axes, like 'c(0.3, 0.7)'

legend.direction

(optional) legend direction; eitehr 'horizontal' or 'vertical'

font_legend_title

(optional) value, in points, of the font in the legend title

font_legend_label

(optional) value, in points, of the font in the legend values

background_colour

(optional) colour argument for the fill of the background, if grey_background == TRUE

font_facet

(optional) value, in points, of the font in the facet titles

panel_spacing

(optional) number of lines between facet panels

font_axis_label

(optional) value, in points, of the font in the axis labels. If changed, will change the other font sizes in the plot unless they are also adjusted.

font_axis_title

(optional) value, in points, of the font in the axis titles

font_subtitle

(optional) value, in points, of the font in the plot subtitle

font_title

(optional) value, in points, of the font in the plot title

grey_background

(optional) if TRUE, make the background of the plot (but not the panel) background_colour

Functions

Examples

1
2
3
4
5
ggplot(mtcars, aes(x = wt, y = mpg, colour = cyl)) + geom_point() + facet_wrap(~am) + ggtitle('Heavier cars have worse gas efficiency') + theme_blank()
ggplot(mtcars, aes(x = wt, y = mpg, colour = cyl)) + geom_point() + facet_wrap(~am) + ggtitle('Heavier cars have worse gas efficiency') + theme_stroke()
ggplot(mtcars, aes(x = wt, y = mpg, colour = cyl)) + geom_point() + facet_wrap(~am) + ggtitle('Heavier cars have worse gas efficiency') + theme_xgrid(legend.position = c(0.8, 0.9), grey_background = TRUE)
ggplot(mtcars, aes(x = wt, y = mpg, colour = cyl)) + geom_point() + facet_wrap(~am) + ggtitle('Heavier cars have worse gas efficiency') + theme_ygrid()
ggplot(mtcars, aes(x = wt, y = mpg, colour = cyl)) + geom_point() + facet_wrap(~am) + ggtitle('Heavier cars have worse gas efficiency', subtitle='data = mtcars') + theme_xygrid()

flaneuse/llamar documentation built on May 16, 2019, 1:18 p.m.