-
Notifications
You must be signed in to change notification settings - Fork 229
/
theme_economist.Rd
102 lines (85 loc) · 2.65 KB
/
theme_economist.Rd
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
96
97
98
99
100
101
102
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/economist.R
\name{theme_economist}
\alias{theme_economist}
\alias{theme_economist_white}
\title{ggplot color theme based on the Economist}
\usage{
theme_economist(
base_size = 10,
base_family = "sans",
horizontal = TRUE,
dkpanel = FALSE
)
theme_economist_white(
base_size = 11,
base_family = "sans",
gray_bg = TRUE,
horizontal = TRUE
)
}
\arguments{
\item{base_size}{base font size, given in pts.}
\item{base_family}{base font family}
\item{horizontal}{\code{logical} Horizontal axis lines?}
\item{dkpanel}{\code{logical} Darker background for panel region?}
\item{gray_bg}{\code{logical} If \code{TRUE}, use gray background, else
use white
background.}
}
\value{
An object of class \code{\link[ggplot2]{theme}()}.
}
\description{
A theme that approximates the style of \emph{The Economist}.
}
\details{
\code{theme_economist} implements the standard bluish-gray
background theme in the print \emph{The Economist} and
\href{https://www.economist.com/}{economist.com}.
\code{theme_economist_white} implements a variant with a while
panel and light gray (or white) background often used by \emph{The Economist}
blog \href{https://www.economist.com/blogs/graphicdetail}{Graphic Detail}.
Use \code{\link{scale_color_economist}()} with this theme.
The x axis should be displayed on the right hand side.
\emph{The Economist} uses "ITC Officina Sans" as its font for graphs. If
you have access to this font, you can use it with the
\pkg{extrafont} package. "Verdana" is a good substitute.
}
\examples{
library("ggplot2")
p <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
facet_wrap(~am) +
# Economist puts x-axis labels on the right-hand side
scale_y_continuous(position = "right")
## Standard
p + theme_economist() +
scale_colour_economist()
# 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()
## Verdana is a widely available substitute
p + theme_economist(base_family="Verdana") +
scale_colour_economist()
}
}
\references{
\itemize{
\item \href{https://www.economist.com/}{The Economist}
\item \href{https://spiekermann.com/en/itc-officina-display/}{Spiekerblog, "ITC Officina Display", January 1, 2007.}
}
}
\concept{themes economist}