Some extra geoms, scales, and themes for ggplot, including:
geom_rangeframe
: Tufte's range framegeom_tufteboxplot
: Tufte's box plot
theme_calc
: a theme based on LibreOffice Calc.theme_economist
: a theme based on the plots in the The Economist magazine.theme_excel
: a theme replicating the classic ugly gray charts in Exceltheme_few
: theme from Stephen Few's "Practical Rules for Using Color in Charts".theme_fivethirtyeight
: a theme based on the plots at fivethirtyeight.com.theme_gdocs
: a theme based on Google Docs.theme_solarized
: a theme using the solarized color palette.theme_stata
: themes based on Stata graph schemes.theme_tufte
: a minimal ink based on Tufte's The Visual Display of Quantitative Information.theme_wsj
: a theme based on the plots in the The Economist magazine.
scale_color_calc
,scale_shape_calc
: color and shape palettes from LibreOffice Calc.scale_color_colorblind
: Colorblind safe palette from http://jfly.iam.u-tokyo.ac.jp/color/.scale_color_economist
: colors used in plots in plots in The Economist.scale_color_excel
: colors from new and old Excel.scale_color_few
: color palettes from Stephen Few's "Practical Rules for Using Color in Charts".scale_color_gdocs
: color palette from Google Docs.scale_color_solarized
: Solarized colorsscale_color_stata
,scale_shapes_stata
,scale_linetype_stata
: color, shape, and linetype palettes from Stata graph schemes.scale_color_tableau
,scale_shape_tableau
: color and shape palettes from Tableau.scale_shape_cleveland
,scale_shape_tremmel
,scale_shape_circlefill
: shape scales from classic works in visual perception: Cleveland, Tremmel (1995), and Lewandowsky and Spence (1989).
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("ggthemes", "jrnold")
Windows users also must first install Rtools.
Contributions are welcome! If you would like to add a theme, scales, etc., fork the repository, add your theme, and submit a pull request.
library("ggplot2")
library("ggthemes")
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
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())
The Tufte minimal boxplot.
(ggplot(mtcars, aes(factor(cyl), mpg))
+ theme_tufte(ticks=FALSE)
+ geom_tufteboxplot())
A theme that approximates the style of plots in The Economist magazine.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_economist()
+ scale_colour_economist()
+ ggtitle("Diamonds Are Forever"))
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"))
The dark theme.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_solarized(light=FALSE)
+ scale_colour_solarized("red"))
An alternative theme.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_solarized_2()
+ scale_colour_solarized("blue"))
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"))
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_excel()
+ scale_colour_excel())
(ggplot(diamonds, aes(clarity, fill=cut))
+ geom_bar()
+ scale_fill_excel()
+ theme_excel())
Inverse of theme_gray
, i.e. white plot area and gray background.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_igray())
Theme and color palette based on the plots at fivethirtyeight.com.
(qplot(hp, mpg, data= subset(mtcars, cyl != 5), geom="point", color = factor(cyl))
+ geom_smooth(method = "lm", se = FALSE)
+ scale_color_fivethirtyeight()
+ theme_fivethirtyeight())
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())
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_igray()
+ scale_colour_tableau("colorblind10"))
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())
Theme and some color palettes based on plots in the The Wall Street Journal.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_wsj()
+ scale_colour_wsj("colors6", "")
+ ggtitle("Diamond Prices"))
Theme and color palettes based on the defaults in Google Docs.
(qplot(carat, price, data=dsamp, colour=clarity)
+ theme_gdocs()
+ ggtitle("Diamonds")
+ scale_color_gdocs())
Theme and color and shape palettes based on the defaults in LibreOffice Calc.
(qplot(carat, price, data=dsamp, colour=clarity)
+ theme_calc()
+ ggtitle("Diamonds")
+ scale_color_calc())
Theme and color palettes based on the pander package.
(qplot(carat, price, data = diamonds, colour = clarity)
+ theme_pander()
+ scale_colour_pander())
(ggplot(diamonds, aes(clarity, fill = cut)) + geom_bar()
+ theme_pander()
+ scale_fill_pander())