Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 169 lines (121 sloc) 3.858 kb
74de502 @jrnold fix #3: renamed package from ggplotJrnold to ggthemes
authored
1 # ggthemes
df6dbc0 @jrnold added example images to README
authored
2
74de502 @jrnold fix #3: renamed package from ggplotJrnold to ggthemes
authored
3 Some extra geoms, scales, and themes for [ggplot](http://had.co.nz/ggplot2/),
df6dbc0 @jrnold added example images to README
authored
4
b21582c @jrnold revising READE docs
authored
5 ## Geoms
6
7 - Tufte range frame
8 - Tufte box plot
9
10 ## Themes
11
12 - Tufte minimal ink theme
13 - [Solarized](http://ethanschoonover.com/solarized)
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
14 - [Stata](http://stata.com/) themes
15 - [The Economist](http://www.economist.com/)
b21582c @jrnold revising READE docs
authored
16 - Excel (the ugly gray background one)
df6dbc0 @jrnold added example images to README
authored
17
216a286 @jrnold misc
authored
18 ## Scales
19
20 - [Solarized](http://ethanschoonover.com/solarized) colors
21 - The Economist colors.
22 - Stata colors, shapes, and linetypes
23 - Excel colors (old and new)
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
24 - [Tableau](http://www.tableausoftware.com/) colors and shapes
216a286 @jrnold misc
authored
25 - Shape scales from William S. Cleveland's *Elements of Graphing Data*,
26 Tremmel (1995), and Lewandowsky and Spence (1989).
269be12 @jrnold typo fixes
authored
27 - Color scale based on Stephen Few's ["Practical Rules for Using Color in Charts"](http://www.perceptualedge.com/articles/visual_business_intelligence/rules_for_using_color.pdf).
216a286 @jrnold misc
authored
28
df6dbc0 @jrnold added example images to README
authored
29 # Install
30
31 It is probably easiest to use the **devtools** package to install the latest version:
32
981a897 @jrnold updates
authored
33 ```{r echo=FALSE,results='hide'}
c848ade @jrnold updated README examples
authored
34 opts_knit$set(upload.fun = imgur_upload)
e8cdcac @jrnold change image heights
authored
35 opts_chunk$set(fig.width = 5.25, fig.height = 3.75, cache=FALSE)
df6dbc0 @jrnold added example images to README
authored
36 ```
37
38 ```r
45f81a9 @jrnold scale_excel_fill defaults to using fill palette
authored
39 library("devtools")
74de502 @jrnold fix #3: renamed package from ggplotJrnold to ggthemes
authored
40 install_github("ggthemes", "jrnold")
df6dbc0 @jrnold added example images to README
authored
41 ```
42
43 # Examples
44
cc64bf3 @jrnold added examples of Stata and Economist
authored
45 ```{r}
45f81a9 @jrnold scale_excel_fill defaults to using fill palette
authored
46 library("ggplot2")
74de502 @jrnold fix #3: renamed package from ggplotJrnold to ggthemes
authored
47 library("ggthemes")
cc64bf3 @jrnold added examples of Stata and Economist
authored
48 dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
49 ```
50
216a286 @jrnold misc
authored
51 ## Tufte theme and geoms
e3bac76 @jrnold added theme_tufte and geom_range_line
authored
52
b21582c @jrnold revising READE docs
authored
53 Minimal theme and geoms based on plots in *The Visual Display of
54 Quantitative Information*.
55
e3bac76 @jrnold added theme_tufte and geom_range_line
authored
56 ```{r}
57 (ggplot(mtcars, aes(wt, mpg))
fd2868a @jrnold rename geom_range_frame to geom_rangeframe for consistency with
authored
58 + geom_point() + geom_rangeframe()
e3bac76 @jrnold added theme_tufte and geom_range_line
authored
59 + theme_tufte())
60 ```
61
216a286 @jrnold misc
authored
62 The Tufte minimal boxplot.
b21582c @jrnold revising READE docs
authored
63
216a286 @jrnold misc
authored
64 ```{r}
65 (ggplot(mtcars, aes(factor(cyl), mpg))
66 + theme_tufte(ticks=FALSE)
67 + geom_tufteboxplot())
b21582c @jrnold revising READE docs
authored
68 ```
69
df6dbc0 @jrnold added example images to README
authored
70 ## Economist theme
71
cc64bf3 @jrnold added examples of Stata and Economist
authored
72 A theme that approximates the style of plots in The Economist
73 magazine.
74
75 ```{r}
76 (qplot(carat, price, data=dsamp, colour=cut)
6a60e2b @jrnold adjusted text heights for Economist theme
authored
77 + theme_economist()
78 + scale_colour_economist()
79 + ggtitle("Diamonds Are Forever"))
cc64bf3 @jrnold added examples of Stata and Economist
authored
80 ```
df6dbc0 @jrnold added example images to README
authored
81
82 ## Solarized theme
83
84 A theme and color and fill scales based on the Solarized palette.
85
216a286 @jrnold misc
authored
86 The light theme.
df6dbc0 @jrnold added example images to README
authored
87
88 ```{r}
89 (qplot(carat, price, data=dsamp, colour=cut)
90 + theme_solarized()
91 + scale_colour_solarized("blue"))
92 ```
93
216a286 @jrnold misc
authored
94 The dark theme.
df6dbc0 @jrnold added example images to README
authored
95
96 ```{r}
97 (qplot(carat, price, data=dsamp, colour=cut)
98 + theme_solarized(light=FALSE)
99 + scale_colour_solarized("red"))
100 ```
cc64bf3 @jrnold added examples of Stata and Economist
authored
101
102 ## Stata theme
103
216a286 @jrnold misc
authored
104 Themes and scales (color, fill, linetype, shapes) based on the graph
105 schemes in Stata.
cc64bf3 @jrnold added examples of Stata and Economist
authored
106
107 ```{r}
108 (qplot(carat, price, data=dsamp, colour=cut)
981a897 @jrnold updates
authored
109 + theme_stata()
110 + scale_colour_stata()
111 + ggtitle("Plot Title"))
cc64bf3 @jrnold added examples of Stata and Economist
authored
112 ```
113
e6920d4 @jrnold added excel theme
authored
114 ## Excel 2003 theme
115
116 For that classic ugly look and feel. For ironic purposes only. 3D bars
45f81a9 @jrnold scale_excel_fill defaults to using fill palette
authored
117 and pies not included. Please never use this theme.
e6920d4 @jrnold added excel theme
authored
118
119 ```{r}
120 (qplot(carat, price, data=dsamp, colour=cut)
121 + theme_excel2003()
122 + scale_colour_excel2003())
123
124 ```
125
126 ```{r}
127 (ggplot(diamonds, aes(clarity, fill=cut))
128 + geom_bar()
45f81a9 @jrnold scale_excel_fill defaults to using fill palette
authored
129 + scale_fill_excel2003()
e6920d4 @jrnold added excel theme
authored
130 + theme_excel2003())
131 ```
132
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
133 ## Inverse Gray Theme
134
135 Inverse of `theme_gray`, i.e. white plot area and gray background.
136
137 ```{r}
138 (qplot(carat, price, data=dsamp, colour=cut)
139 + theme_igray())
140 ```
141
142
216a286 @jrnold misc
authored
143 ## Tableau Scales
144
145 Color, fill, and shape scales based on those used in the Tableau softare.
146
147 ```{r}
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
148 (qplot(carat, price, data=dsamp, colour=cut)
149 + theme_igray()
150 + scale_colour_tableau())
216a286 @jrnold misc
authored
151 ```
45f81a9 @jrnold scale_excel_fill defaults to using fill palette
authored
152
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
153 ```{r}
154 (qplot(carat, price, data=dsamp, colour=cut)
155 + theme_igray()
156 + scale_colour_tableau("colorblind10"))
157 ```
158
d10a251 @jrnold updated documentation
authored
159 ## Stephen Few's Practical Rules for Using Color ...
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
160
d10a251 @jrnold updated documentation
authored
161 Color palette and theme based on Stephen Few's ["Practical Rules for Using Color in Charts"](http://www.perceptualedge.com/articles/visual_business_intelligence/rules_for_using_color.pdf).
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
162
163 ```{r}
164 (qplot(carat, price, data=dsamp, colour=cut)
d10a251 @jrnold updated documentation
authored
165 + theme_few()
85869f9 @jrnold added tableau, few, and theme_igray examples
authored
166 + scale_colour_few())
167 ```
168
Something went wrong with that request. Please try again.