Learn R Programming

ggthemes (version 2.1.0)

theme_economist: ggplot color theme based on the Economist

Description

Style plots similar to those in The Economist.

Usage

theme_economist(base_size = 10, base_family = "sans", horizontal = TRUE,
  dkpanel = FALSE, stata = FALSE)

theme_economist_white(base_size = 11, base_family = "sans", gray_bg = TRUE, horizontal = TRUE)

Arguments

base_size
numeric base font size
base_family
character base font family
horizontal
logical. Horizontal axis lines?
dkpanel
logical Darker background for panel region?
stata
logical Use RGB values from Stata's economist scheme.
gray_bg
logical If TRUE, use gray background, else use white background.

Value

  • An object of class theme.

Details

theme_economist implements the standard bluish-gray background theme in the print The Economist and http://economist.com{economist.com}. theme_economist_white implements a variant with a while panel and light gray (or white) background used by The Economist blog http://www.economist.com/blogs/graphicdetail{Graphic Detail}.

The Economist uses "ITC Officina Sans" as its font for graphs. If you have access to this font, you can use it with the extrafont package. "Verdana" is a good substitute.

References

  • http://economist.com{The Economist}
  • http://spiekermann.com/en/itc-officina-display/{Spiekerblog, "ITC Officina Display", January 1, 2007.}
  • http://www.economist.com/help/about-us

See Also

theEconomist.theme for an Economist theme for lattice plots.

Examples

Run this code
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
q <- (qplot(carat, price, data=dsamp, colour=clarity)
      + ggtitle("Diamonds Are Forever"))

## Standard
q + theme_economist() + scale_colour_economist()

## Stata colors
q + theme_economist(stata=TRUE) + scale_colour_economist(stata=TRUE)

## Darker plot region
q + theme_economist(dkpanel=TRUE) + scale_colour_economist(stata=TRUE)

## Darker plot region is best for for facets
dkblue <- ggthemes_data$economist$fg['blue_dark']
(ggplot(data=dsamp, aes(x=carat, y=price))
 + geom_point(colour=dkblue)
 + facet_grid(. ~ cut )
 + theme_economist(dkpanel=TRUE))

##' ## Change axis lines to vertical
(q + theme_economist(horizontal=FALSE)
 + scale_colour_economist() + coord_flip())

## White panel/light gray background
(q + theme_economist_white()
 + scale_colour_economist())

## All white variant
(q + theme_economist_white(gray_bg=FALSE)
 + scale_colour_economist())
## The Economist uses ITC Officina Sans
library(extrafont)
(q + theme_economist(base_family="ITC Officina Sans")
+ scale_colour_economist())

## Verdana is a widely available substitute
(q + theme_economist(base_family="Verdana")
+ scale_colour_economist())

Run the code above in your browser using DataLab