| theme_economist | R Documentation |
A theme that approximates the style of charts in The Economist.
theme_economist(
base_size = 10,
base_family = "sans",
horizontal = TRUE,
dkpanel = deprecated()
)
theme_economist_white(
base_size = 10,
base_family = "sans",
gray_bg = deprecated(),
horizontal = TRUE
)
base_size |
base font size, given in pts. |
base_family |
base font family |
horizontal |
|
dkpanel |
'r lifecycle::badge("deprecated")' The darker panel was a feature of the pre-2017 design and no longer has any effect. |
gray_bg |
'r lifecycle::badge("deprecated")' No longer has any effect. |
This follows the chart design The Economist introduced in 2017
and still publishes today: a white plot area on a pale ground, light
horizontal gridlines only, a black x-axis baseline with tick marks
below it, and no y-axis rule or ticks. Use
scale_colour_economist() with it.
Two conventions of the house style cannot be expressed as theme elements, and have to be set on the plot itself:
The Economist puts the y axis on the right. Use
scale_y_continuous(position = "right").
Charts are tagged with a small red rectangle above the title.
Draw it with annotate() or
grid.rect() in "Econ red", which is
ggthemes_data$economist$main row "econ red".
The Economist sets charts in "Econ Sans", which is not publicly available. Any narrow humanist sans is a reasonable substitute; with the extrafont package, "Roboto Condensed" or "Fira Sans Condensed" are close.
An object of class theme().
The Economist visual styleguide, version 1.2, 4 May 2017.
library("ggplot2")
p <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
facet_wrap(~am) +
# The Economist puts the y-axis labels on the right-hand side
scale_y_continuous(position = "right") +
labs(
title = "Heavier, thirstier",
subtitle = "Fuel economy v weight, by number of forward gears",
caption = "Source: Motor Trend, 1974"
)
## Standard
p + theme_economist() +
scale_colour_economist()
# Vertical gridlines, for use with coord_flip()
p + theme_economist(horizontal = FALSE) +
scale_colour_economist() +
coord_flip()
## Ordered data uses one hue's equal-lightness steps instead
ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = hp)) +
scale_colour_economist_c(hue = "blue") +
theme_economist()
## Not run:
## The Economist sets charts in "Econ Sans", which is not publicly
## available. Any narrow humanist sans is a reasonable substitute, if it is
## installed on your system.
p + theme_economist(base_family = "Roboto Condensed") +
scale_colour_economist()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.