Some extra geoms, scales, and themes for ggplot.
Install
To install the stable version from CRAN,
install.packages('ggthemes', dependencies = TRUE)Or, to install the development version from github, use the devtools package,
library("devtools")
install_github(c("hadley/ggplot2", "jrnold/ggthemes"))How to use
For a quick tutorial, check out Rafael Irizarry’s book.
Examples
library("ggplot2")
library("ggthemes")
mtcars2 <- within(mtcars, {
vs <- factor(vs, labels = c("V-shaped", "Straight"))
am <- factor(am, labels = c("Automatic", "Manual"))
cyl <- factor(cyl)
gear <- factor(gear)
})
p1 <- ggplot(mtcars2) +
geom_point(aes(x = wt, y = mpg, colour = gear)) +
labs(
title = "Fuel economy declines as weight increases",
subtitle = "(1973-74)",
caption = "Data from the 1974 Motor Trend US magazine.",
x = "Weight (1000 lbs)",
y = "Fuel economy (mpg)",
colour = "Gears"
)
p1 +
scale_color_calc() +
theme_calc()
p1 + theme_clean()
p1 + theme_economist() +
scale_colour_economist()
p1 + theme_excel() +
scale_colour_excel()
p1 + theme_excel_new() +
scale_colour_excel_new()
p1 + theme_igray()
p1 + theme_par()
p1 + theme_fivethirtyeight()
p1 + theme_few() +
scale_colour_few()
p1 + theme_solarized() +
scale_colour_solarized()
p1 + theme_solarized(light=FALSE) +
scale_colour_solarized()
p1 + theme_solid()
p1 + theme_tufte()
p1 + theme_wsj(base_size = 8) + scale_color_wsj()
p1 + scale_color_colorblind()
p1 + scale_color_tableau()
Color palettes
Every colour palette shipped with ggthemes is shown below. Each row is one palette; the swatches are in the order returned by the corresponding palette function. This compact, data-derived gallery follows the palette-overview approach used by ggpalettes and the one-palette-per-row display in sjPlot.
General
colorblind_pal(black = TRUE)
|
|
||||||||||||||||||||||||
calc_pal()
|
|
||||||||||||||||||||||||
economist_pal(fill = FALSE)
|
|
||||||||||||||||||||||||
economist_pal(fill = TRUE)
|
|
||||||||||||||||||||||||
fivethirtyeight_pal()
|
|
||||||||||||||||||||||||
gdocs_pal()
|
|
||||||||||||||||||||||||
palette_pander(random_order = FALSE)
|
|
||||||||||||||||||||||||
ptol_pal()
|
|
Canva
canva_pal(“Fresh and bright”)
|
|
||||
canva_pal(“Subdued and proffesional”)
|
|
||||
canva_pal(“Dark and earthy”)
|
|
||||
canva_pal(“Crisp and dramatic”)
|
|
||||
canva_pal(“Cool blues”)
|
|
||||
canva_pal(“Outdoorsy and Natural”)
|
|
||||
canva_pal(“Watery blue-greens”)
|
|
||||
canva_pal(“Primary colors with a vibrant twist”)
|
|
||||
canva_pal(“Refreshing and pretty”)
|
|
||||
canva_pal(“Playful greens and blues”)
|
|
||||
canva_pal(“Fresh and energetic”)
|
|
||||
canva_pal(“Surf and turf”)
|
|
||||
canva_pal(“Autumn in vermont”)
|
|
||||
canva_pal(“Icy blues and grays”)
|
|
||||
canva_pal(“Birds and berries”)
|
|
||||
canva_pal(“Day and night”)
|
|
||||
canva_pal(“Stylish and retro”)
|
|
||||
canva_pal(“Shades of citrus”)
|
|
||||
canva_pal(“Sunset to dusk”)
|
|
||||
canva_pal(“Bright and tropical”)
|
|
||||
canva_pal(“Warm naturals”)
|
|
||||
canva_pal(“Bold berries”)
|
|
||||
canva_pal(“Summer sunflower”)
|
|
||||
canva_pal(“Modern and crisp”)
|
|
||||
canva_pal(“Timeless and nautical”)
|
|
||||
canva_pal(“Neutral and versatile”)
|
|
||||
canva_pal(“Cheerful brights”)
|
|
||||
canva_pal(“Garden fresh”)
|
|
||||
canva_pal(“Summer barbeque”)
|
|
||||
canva_pal(“Berry blues”)
|
|
||||
canva_pal(“Lemonade stand”)
|
|
||||
canva_pal(“Serene and spa like”)
|
|
||||
canva_pal(“Fun and tropical”)
|
|
||||
canva_pal(“Spicy neutrals”)
|
|
||||
canva_pal(“Pastels”)
|
|
||||
canva_pal(“Bold and cultured”)
|
|
||||
canva_pal(“Sunny citrus”)
|
|
||||
canva_pal(“Crisp complementary colors”)
|
|
||||
canva_pal(“Warm and rustic”)
|
|
||||
canva_pal(“Neon night”)
|
|
||||
canva_pal(“Jewel tones”)
|
|
||||
canva_pal(“Polished and inviting”)
|
|
||||
canva_pal(“Fresh greens”)
|
|
||||
canva_pal(“Wintery reds”)
|
|
||||
canva_pal(“Summer fiesta”)
|
|
||||
canva_pal(“Chocolaty browns”)
|
|
||||
canva_pal(“Naturally elegant”)
|
|
||||
canva_pal(“Cozy and warm”)
|
|
||||
canva_pal(“Violet sunset”)
|
|
||||
canva_pal(“Strawberries and cream”)
|
|
||||
canva_pal(“Grecian holiday”)
|
|
||||
canva_pal(“Bold and basic”)
|
|
||||
canva_pal(“Vineyard neutrals”)
|
|
||||
canva_pal(“Modern and urban”)
|
|
||||
canva_pal(“Misty greens”)
|
|
||||
canva_pal(“Sunkissed village”)
|
|
||||
canva_pal(“Sun and sky”)
|
|
||||
canva_pal(“Aqua blues”)
|
|
||||
canva_pal(“Urban oasis”)
|
|
||||
canva_pal(“Candy coated brights”)
|
|
||||
canva_pal(“Muted and antique”)
|
|
||||
canva_pal(“Classy and timeless”)
|
|
||||
canva_pal(“Cosmopolitan”)
|
|
||||
canva_pal(“Cheerful and friendly”)
|
|
||||
canva_pal(“Nightlife”)
|
|
||||
canva_pal(“Coastal”)
|
|
||||
canva_pal(“Maritime brights”)
|
|
||||
canva_pal(“Vintage charm”)
|
|
||||
canva_pal(“Understated and versatile”)
|
|
||||
canva_pal(“Artic sunrise”)
|
|
||||
canva_pal(“Mediterranean afternoon”)
|
|
||||
canva_pal(“Hazy grays”)
|
|
||||
canva_pal(“City sights”)
|
|
||||
canva_pal(“Retro and relaxing”)
|
|
||||
canva_pal(“Green fields”)
|
|
||||
canva_pal(“Distintive and unexpected”)
|
|
||||
canva_pal(“Sleek and modern”)
|
|
||||
canva_pal(“Orange accent”)
|
|
||||
canva_pal(“Beyond black and white”)
|
|
||||
canva_pal(“Shabby chic neutrals”)
|
|
||||
canva_pal(“Warm and cool”)
|
|
||||
canva_pal(“Industrial and in control”)
|
|
||||
canva_pal(“Autumn oranges and complemtentary neutrals”)
|
|
||||
canva_pal(“Pool party”)
|
|
||||
canva_pal(“Classic metallics”)
|
|
||||
canva_pal(“Subtle and versatile”)
|
|
||||
canva_pal(“Professional and traditional”)
|
|
||||
canva_pal(“Light and natural”)
|
|
||||
canva_pal(“Shadowy and dramatic”)
|
|
||||
canva_pal(“Golden afternoon”)
|
|
||||
canva_pal(“Dark and handsome”)
|
|
||||
canva_pal(“Technology meets nature”)
|
|
||||
canva_pal(“Cheerful blues and pink”)
|
|
||||
canva_pal(“Exotic and high impact”)
|
|
||||
canva_pal(“Back to school”)
|
|
||||
canva_pal(“Bright and painterly”)
|
|
||||
canva_pal(“Urban living”)
|
|
||||
canva_pal(“1950s kitchen”)
|
|
||||
canva_pal(“Smoky purples”)
|
|
||||
canva_pal(“Trendy and metropolitan”)
|
|
||||
canva_pal(“Fun and professional”)
|
|
||||
canva_pal(“Art history inspired”)
|
|
||||
canva_pal(“Muted tones”)
|
|
||||
canva_pal(“Modern and clean”)
|
|
||||
canva_pal(“Neon tones and sharp contrast”)
|
|
||||
canva_pal(“Muted and minimal”)
|
|
||||
canva_pal(“Warm and bold”)
|
|
||||
canva_pal(“Clean and highlighted”)
|
|
||||
canva_pal(“Warm tones”)
|
|
||||
canva_pal(“Sharp and modern”)
|
|
||||
canva_pal(“Cool vs warm”)
|
|
||||
canva_pal(“Pretty pastels”)
|
|
||||
canva_pal(“Bold and punchy”)
|
|
||||
canva_pal(“Tints and tones”)
|
|
||||
canva_pal(“Splash of color”)
|
|
||||
canva_pal(“Elegant and sophisticated”)
|
|
||||
canva_pal(“Summer inspired”)
|
|
||||
canva_pal(“Professional and modern”)
|
|
||||
canva_pal(“Bold blacks and vibrand highlights”)
|
|
||||
canva_pal(“Clean gradient and fresh blues”)
|
|
||||
canva_pal(“Cheerful and sleek”)
|
|
||||
canva_pal(“Luxurious and modern”)
|
|
||||
canva_pal(“Unique and striking”)
|
|
||||
canva_pal(“Unexpected color combinations”)
|
|
||||
canva_pal(“Retro inspired”)
|
|
||||
canva_pal(“Antique and clean”)
|
|
||||
canva_pal(“Striking and energetic”)
|
|
||||
canva_pal(“Fresh and lively”)
|
|
||||
canva_pal(“Clean and crisp”)
|
|
||||
canva_pal(“Colorful without clashing”)
|
|
||||
canva_pal(“Cool and calm”)
|
|
||||
canva_pal(“Modern and muted”)
|
|
||||
canva_pal(“Earthy and fresh”)
|
|
||||
canva_pal(“High saturation and high energy”)
|
|
||||
canva_pal(“Warm and wonderful”)
|
|
||||
canva_pal(“Vintage charm 2”)
|
|
||||
canva_pal(“Cool jewel tones”)
|
|
||||
canva_pal(“Stormy hues”)
|
|
||||
canva_pal(“Clean and collegiate”)
|
|
||||
canva_pal(“Simple and fresh”)
|
|
||||
canva_pal(“Tropical tones”)
|
|
||||
canva_pal(“Bold feature colors”)
|
|
||||
canva_pal(“Antique tones”)
|
|
||||
canva_pal(“Neon and bold”)
|
|
||||
canva_pal(“Simple but bold”)
|
|
||||
canva_pal(“Corporate and sleek”)
|
|
||||
canva_pal(“Modern and minimal”)
|
|
||||
canva_pal(“Fun and cheerful”)
|
|
||||
canva_pal(“Sunny and calm”)
|
|
||||
canva_pal(“Pop art”)
|
|
Excel
excel_pal(line = TRUE)
|
|
|||||||
excel_pal(line = FALSE)
|
|
|||||||
excel_new_pal(“Atlas”)
|
|
|||||||
excel_new_pal(“Badge”)
|
|
|||||||
excel_new_pal(“Berlin”)
|
|
|||||||
excel_new_pal(“Celestial”)
|
|
|||||||
excel_new_pal(“Crop”)
|
|
|||||||
excel_new_pal(“Depth”)
|
|
|||||||
excel_new_pal(“Droplet”)
|
|
|||||||
excel_new_pal(“Facet”)
|
|
|||||||
excel_new_pal(“Feathered”)
|
|
|||||||
excel_new_pal(“Gallery”)
|
|
|||||||
excel_new_pal(“Headlines”)
|
|
|||||||
excel_new_pal(“Integral”)
|
|
|||||||
excel_new_pal(“Ion Boardroom”)
|
|
|||||||
excel_new_pal(“Ion”)
|
|
|||||||
excel_new_pal(“Madison”)
|
|
|||||||
excel_new_pal(“Main Event”)
|
|
|||||||
excel_new_pal(“Mesh”)
|
|
|||||||
excel_new_pal(“Office”)
|
|
|||||||
excel_new_pal(“Office 2013”)
|
|
|||||||
excel_new_pal(“Organic”)
|
|
|||||||
excel_new_pal(“Parallax”)
|
|
|||||||
excel_new_pal(“Parcel”)
|
|
|||||||
excel_new_pal(“Retrospect”)
|
|
|||||||
excel_new_pal(“Savon”)
|
|
|||||||
excel_new_pal(“Slice”)
|
|
|||||||
excel_new_pal(“Vapor Trail”)
|
|
|||||||
excel_new_pal(“View”)
|
|
|||||||
excel_new_pal(“Wisp”)
|
|
|||||||
excel_new_pal(“Wood Type”)
|
|
|||||||
excel_new_pal(“Aspect”)
|
|
|||||||
excel_new_pal(“Blue Green”)
|
|
|||||||
excel_new_pal(“Blue II”)
|
|
|||||||
excel_new_pal(“Blue Warm”)
|
|
|||||||
excel_new_pal(“Blue”)
|
|
|||||||
excel_new_pal(“Grayscale”)
|
|
|||||||
excel_new_pal(“Green Yellow”)
|
|
|||||||
excel_new_pal(“Green”)
|
|
|||||||
excel_new_pal(“Marquee”)
|
|
|||||||
excel_new_pal(“Median”)
|
|
|||||||
excel_new_pal(“Office 2007”)
|
|
|||||||
excel_new_pal(“Orange Red”)
|
|
|||||||
excel_new_pal(“Orange”)
|
|
|||||||
excel_new_pal(“Paper”)
|
|
|||||||
excel_new_pal(“Red Orange”)
|
|
|||||||
excel_new_pal(“Red Violet”)
|
|
|||||||
excel_new_pal(“Red”)
|
|
|||||||
excel_new_pal(“Slipstream”)
|
|
|||||||
excel_new_pal(“Violet II”)
|
|
|||||||
excel_new_pal(“Violet”)
|
|
|||||||
excel_new_pal(“Yellow Orange”)
|
|
|||||||
excel_new_pal(“Yellow”)
|
|
Few
few_pal(“Light”)
|
|
||||||||
few_pal(“Medium”)
|
|
||||||||
few_pal(“Dark”)
|
|
Highcharts
hc_pal(“default”)
|
|
|||||||||||
hc_pal(“default_dark”)
|
|
|||||||||||
hc_pal(“classic”)
|
|
|||||||||||
hc_pal(“darkunica”)
|
|
|||||||||||
hc_pal(“grid_light”)
|
|
|||||||||||
hc_pal(“sand_signika”)
|
|
|||||||||||
hc_pal(“high_contrast_light”)
|
|
|||||||||||
hc_pal(“high_contrast_dark”)
|
|
|||||||||||
hc_pal(“avocado”)
|
|
|||||||||||
hc_pal(“sunset”)
|
|
Numbers
numbers_pal(“Blue Green”)
|
|
||||||
numbers_pal(“Blue Violet”)
|
|
||||||
numbers_pal(“Blue”)
|
|
||||||
numbers_pal(“Brown”)
|
|
||||||
numbers_pal(“Classic”)
|
|
||||||
numbers_pal(“Earth Tone”)
|
|
||||||
numbers_pal(“Gray”)
|
|
||||||
numbers_pal(“Green”)
|
|
||||||
numbers_pal(“Jade”)
|
|
||||||
numbers_pal(“Mid Century”)
|
|
||||||
numbers_pal(“Showroom”)
|
|
||||||
numbers_pal(“Spectrum”)
|
|
Solarized
solarized_pal(“yellow”)
|
|
||||||||
solarized_pal(“orange”)
|
|
||||||||
solarized_pal(“red”)
|
|
||||||||
solarized_pal(“magenta”)
|
|
||||||||
solarized_pal(“violet”)
|
|
||||||||
solarized_pal(“blue”)
|
|
||||||||
solarized_pal(“cyan”)
|
|
||||||||
solarized_pal(“green”)
|
|
Stata
stata_pal(“s2color”)
|
|
|||||||||||||||
stata_pal(“s1rcolor”)
|
|
|||||||||||||||
stata_pal(“s1color”)
|
|
|||||||||||||||
stata_pal(“mono”)
|
|
|||||||||||||||
stata_pal(“stcolor”)
|
|
|||||||||||||||
stata_pal(“economist”)
|
|
Tableau — discrete
tableau_color_pal(“Tableau 10”)
|
|
||||||||||||||||||||
tableau_color_pal(“Tableau 20”)
|
|
||||||||||||||||||||
tableau_color_pal(“Color Blind”)
|
|
||||||||||||||||||||
tableau_color_pal(“Seattle Grays”)
|
|
||||||||||||||||||||
tableau_color_pal(“Traffic”)
|
|
||||||||||||||||||||
tableau_color_pal(“Miller Stone”)
|
|
||||||||||||||||||||
tableau_color_pal(“Superfishel Stone”)
|
|
||||||||||||||||||||
tableau_color_pal(“Nuriel Stone”)
|
|
||||||||||||||||||||
tableau_color_pal(“Jewel Bright”)
|
|
||||||||||||||||||||
tableau_color_pal(“Summer”)
|
|
||||||||||||||||||||
tableau_color_pal(“Winter”)
|
|
||||||||||||||||||||
tableau_color_pal(“Green-Orange-Teal”)
|
|
||||||||||||||||||||
tableau_color_pal(“Blue-Red-Brown”)
|
|
||||||||||||||||||||
tableau_color_pal(“Purple-Pink-Gray”)
|
|
||||||||||||||||||||
tableau_color_pal(“Hue Circle”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic 10”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic 10 Medium”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic 10 Light”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic 20”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Gray 5”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Color Blind”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Traffic Light”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Purple-Gray 6”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Purple-Gray 12”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Green-Orange 6”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Green-Orange 12”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Blue-Red 6”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Blue-Red 12”)
|
|
||||||||||||||||||||
tableau_color_pal(“Classic Cyclic”)
|
|
Tableau — diverging
tableau_div_gradient_pal(“Orange-Blue Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Green Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Green-Blue Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Blue Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Black Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Gold-Purple Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Green-Gold Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Sunset-Sunrise Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Orange-Blue-White Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Green-White Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Green-Blue-White Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Blue-White Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Red-Black-White Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Orange-Blue Light Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Temperature Diverging”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-Green”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-Blue”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-Black”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Area Red-Green”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Orange-Blue”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Green-Blue”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-White-Green”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-White-Black”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Orange-White-Blue”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-White-Black Light”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Orange-White-Blue Light”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-White-Green Light”)
|
|
|||||||||||||||||||||
tableau_div_gradient_pal(“Classic Red-Green Light”)
|
|
Tableau — sequential
tableau_seq_gradient_pal(“Blue-Green Sequential”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Blue Light”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Orange Light”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Blue”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Orange”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Green”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Red”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Purple”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Brown”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Gray”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Gray Warm”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Blue-Teal”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Orange-Gold”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Green-Gold”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Red-Gold”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Green”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Gray”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Blue”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Red”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Orange”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Area Red”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Area Green”)
|
|
||||||||||||||||||||
tableau_seq_gradient_pal(“Classic Area Brown”)
|
|
Wall Street Journal
wsj_pal(“rgby”)
|
|
||||||
wsj_pal(“red_green”)
|
|
||||||
wsj_pal(“black_green”)
|
|
||||||
wsj_pal(“dem_rep”)
|
|
||||||
wsj_pal(“colors6”)
|
|

