Skip to content
This repository

ggplot themes and scales

tree: 09ca406edc

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

ggplotJrnold

Some extra themes and scales for ggplot,

Geoms

  • Tufte range frame
  • Tufte box plot

Themes

Scales

  • Solarized colors
  • The Economist colors.
  • Stata colors, shapes, and linetypes
  • Excel colors (old and new)
  • Tableau colors and shapes
  • Shape scales from William S. Cleveland's Elements of Graphing Data, Tremmel (1995), and Lewandowsky and Spence (1989).
  • Color scale based on Stephen Few's "Practical Rules for Using Color in Charts".

Install

It is probably easiest to use the devtools package to install the latest version:

library("devtools")
install_github("ggplotJrnold", "jrnold")

Examples

library("ggplot2")
library("ggplotJrnold")
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]

Tufte theme and geoms

Minimal theme and geoms based on plots in The Visual Display of Quantitative Information.

(ggplot(mtcars, aes(wt, mpg)) + geom_point() + geom_rangeframe() + 
    theme_tufte())

plot of chunk unnamed-chunk-3

The Tufte minimal boxplot.

(ggplot(mtcars, aes(factor(cyl), mpg)) + theme_tufte(ticks = FALSE) + 
    geom_tufteboxplot())

plot of chunk unnamed-chunk-4

Economist theme

A theme that approximates the style of plots in The Economist magazine.

(qplot(carat, price, data = dsamp, colour = cut) + theme_economist() + 
    scale_colour_economist())

plot of chunk unnamed-chunk-5

Solarized theme

A theme and color and fill scales based on the Solarized palette.

The light theme.

(qplot(carat, price, data = dsamp, colour = cut) + theme_solarized() + 
    scale_colour_solarized("blue"))

plot of chunk unnamed-chunk-6

The dark theme.

(qplot(carat, price, data = dsamp, colour = cut) + theme_solarized(light = FALSE) + 
    scale_colour_solarized("red"))

plot of chunk unnamed-chunk-7

Stata theme

Themes and scales (color, fill, linetype, shapes) based on the graph schemes in Stata.

(qplot(carat, price, data = dsamp, colour = cut) + theme_stata() + 
    scale_colour_stata() + ggtitle("Plot Title"))

plot of chunk unnamed-chunk-8

Excel 2003 theme

For that classic ugly look and feel. For ironic purposes only. 3D bars and pies not included. Please never use this theme.

(qplot(carat, price, data = dsamp, colour = cut) + theme_excel2003() + 
    scale_colour_excel2003())

plot of chunk unnamed-chunk-9

(ggplot(diamonds, aes(clarity, fill = cut)) + geom_bar() + scale_fill_excel2003() + 
    theme_excel2003())

plot of chunk unnamed-chunk-10

Inverse Gray Theme

Inverse of theme_gray, i.e. white plot area and gray background.

(qplot(carat, price, data = dsamp, colour = cut) + theme_igray())

plot of chunk unnamed-chunk-11

Tableau Scales

Color, fill, and shape scales based on those used in the Tableau softare.

(qplot(carat, price, data = dsamp, colour = cut) + theme_igray() + 
    scale_colour_tableau())

plot of chunk unnamed-chunk-12

(qplot(carat, price, data = dsamp, colour = cut) + theme_igray() + 
    scale_colour_tableau("colorblind10"))

plot of chunk unnamed-chunk-13

Stephen Few's Practical Rules for Using Color ...

Color palette and theme based on Stephen Few's "Practical Rules for Using Color in Charts".

(qplot(carat, price, data = dsamp, colour = cut) + theme_few() + 
    scale_colour_few())

plot of chunk unnamed-chunk-14

Something went wrong with that request. Please try again.