Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

theme_economist

ggplot color theme based on the Economist


Description

A theme that approximates the style of 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

base_size

base font size, given in pts.

base_family

base font family

horizontal

logical Horizontal axis lines?

dkpanel

logical Darker background for panel region?

gray_bg

logical If TRUE, use gray background, else use white background.

Details

theme_economist implements the standard bluish-gray background theme in the print The Economist and economist.com.

theme_economist_white implements a variant with a while panel and light gray (or white) background often used by The Economist blog Graphic Detail.

Use scale_color_economist() with this theme. The x axis should be displayed on the right hand side.

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.

Value

An object of class theme().

References

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()

## Not run: 

## 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()


## End(Not run)

ggthemes

Extra Themes, Scales and Geoms for 'ggplot2'

v4.2.4
GPL-2
Authors
Jeffrey B. Arnold [aut, cre] (<https://orcid.org/0000-0001-9953-3904>), Gergely Daroczi [ctb], Bo Werth [ctb], Brian Weitzner [ctb], Joshua Kunst [ctb], Baptise Auguie [ctb], Bob Rudis [ctb], Hadley Wickham [ctb] (Code from the ggplot2 package.), Justin Talbot [ctb] (Code from the labeling package), Joshua London [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.