-
Notifications
You must be signed in to change notification settings - Fork 226
/
README.Rmd
138 lines (108 loc) · 2.89 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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()
```