Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://jrnold.github.io/ggthemes/

Additional themes, scales, and geoms for ggplot2
https://jrnold.github.io/ggthemes/

data-visualisation ggplot2 ggplot2-themes plot plotting theme visualization

Last synced: 2 days ago
JSON representation

Additional themes, scales, and geoms for ggplot2

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```

[![R-CMD-check](https://github.com/jrnold/ggthemes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jrnold/ggthemes/actions/workflows/R-CMD-check.yaml)
[![Code Coverage Status](https://codecov.io/gh/jrnold/ggthemes/branch/master/graph/badge.svg)](https://codecov.io/github/jrnold/ggthemes?branch=master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/ggthemes)](https://github.com/metacran/cranlogs.app)
[![CRAN status](https://www.r-pkg.org/badges/version/ggthemes)](https://CRAN.R-project.org/package=ggthemes)
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)

Some extra geoms, scales, and themes for
[ggplot](https://ggplot2.tidyverse.org/).

## Install

To install the stable version from CRAN,

```r
install.packages('ggthemes', dependencies = TRUE)
```

Or, to install the development version from github, use the
**devtools** package,

```r
library("devtools")
install_github(c("hadley/ggplot2", "jrnold/ggthemes"))
```

## How to use

For a quick tutorial, check out [Rafael Irizarry's book](https://rafalab.github.io/dsbook/ggplot2.html#add-on-packages).

## Examples

```{r}
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"
)
```

```{r,theme_calc}
p1 +
scale_color_calc() +
theme_calc()
```

```{r,theme_clean}
p1 + theme_clean()
```

```{r,theme_economist}
p1 + theme_economist() +
scale_colour_economist()
```

```{r,theme_excel}
p1 + theme_excel() +
scale_colour_excel()
```

```{r,theme_excel_new}
p1 + theme_excel_new() +
scale_colour_excel_new()
```

```{r,theme_igray}
p1 + theme_igray()
```

```{r,theme_par}
p1 + theme_par()
```

```{r,theme_fivethirtyeight}
p1 + theme_fivethirtyeight()
```

```{r,theme_few}
p1 + theme_few() +
scale_colour_few()
```
```{r,theme_solarized}
p1 + theme_solarized() +
scale_colour_solarized()
```

```{r,theme_solarized_dark}
p1 + theme_solarized(light=FALSE) +
scale_colour_solarized()
```

```{r,theme_solid}
p1 + theme_solid()
```

```{r,theme_stata}
p1 + theme_tufte()
```

```{r,theme_wsj}
p1 + theme_wsj(base_size = 8) + scale_color_wsj()
```

```{r,scale_colorblind}
p1 + scale_color_colorblind()
```

```{r,scale_color_tableau}
p1 + scale_color_tableau()
```