-
Notifications
You must be signed in to change notification settings - Fork 232
/
ex-theme_economist.R
43 lines (32 loc) · 1.05 KB
/
ex-theme_economist.R
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
library("ggplot2")
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
colour = factor(gear))) +
facet_wrap(~am) +
# Economist puts scales on the right-hand side
scale_y_continuous(position = "right")
## Standard
p + theme_economist() + scale_colour_economist()
## Stata colors
p + theme_economist(stata = TRUE) + scale_colour_economist(stata = TRUE)
## Darker plot region
p + theme_economist(dkpanel = TRUE) + scale_colour_economist(stata = TRUE)
# Change axis lines to vertical
p + theme_economist(horizontal = FALSE) +
scale_colour_economist() +
coord_flip()
## White panel/light gray background
p + theme_economist_white() +
scale_colour_economist()
## All white variant
p + theme_economist_white(gray_bg = FALSE) +
scale_colour_economist()
\dontrun{
## The Economist uses ITC Officina Sans
library(extrafont)
p + theme_economist(base_family="ITC Officina Sans") +
scale_colour_economist()
##D
## Verdana is a widely available substitute
p + theme_economist(base_family="Verdana") +
scale_colour_economist()
}