1- # ggplot2 2.2.0 coming soon!
1+ ---
2+ output :
3+ html_document :
4+ self_contained : false
5+ highlight : NULL
6+ ---
27
38``` {r setup, include=FALSE}
49library(ggplot2)
@@ -8,8 +13,11 @@ library(forcats)
813knitr::opts_chunk$set(
914 fig.asp = 1 / 1.6,
1015 out.width = "75%",
16+ fig.width = 5,
1117 collapse = TRUE,
12- comment = "#>"
18+ comment = "#>",
19+ dpi = 96,
20+ fig.retina = NULL
1321)
1422```
1523
@@ -67,7 +75,7 @@ The facet and layout implementation has been moved to ggproto and received a lar
6775 ``` {r}
6876 ggplot(diamonds, aes(carat, price)) +
6977 geom_hex(bins = 20) +
70- facet_wrap(~cut_number(depth, 9 ))
78+ facet_wrap(~cut_number(depth, 6 ))
7179 ```
7280
7381 * Axes were dropped when the panels in `facet_wrap()` did not completely
@@ -89,15 +97,15 @@ The facet and layout implementation has been moved to ggproto and received a lar
8997 scale_y_continuous(position = "right")
9098 ```
9199
92- * It is now possible to display a secondary axis that is a linear
93- transformation of the primary axis through the `sec.axis` argument:
100+ * You can display a secondary axis that is a one-to-one transformation of the
101+ primary axis with the `sec.axis` argument:
94102
95103 ```{r}
96104 ggplot(mpg, aes(displ, hwy)) +
97105 geom_point() +
98106 scale_y_continuous(
99- "miles / galloon ",
100- sec.axis = sec_axis(~ 235 / . , name = "L / 100km ")
107+ "mpg (US) ",
108+ sec.axis = sec_axis(~ . * 1.20 , name = "mpg (UK) ")
101109 )
102110 ```
103111
@@ -119,8 +127,9 @@ The facet and layout implementation has been moved to ggproto and received a lar
119127## Theming
120128
121129* Blank elements can now be overridden again so you get the expected
122- behavior when setting e.g. `axis.line.x`. Furthermore, `element_line()`
123- gets an `arrow` argument that lets you put arrows on axes.
130+ behavior when setting e.g. `axis.line.x`.
131+
132+ * `element_line()` gets an `arrow` argument that lets you put arrows on axes.
124133
125134 ```{r}
126135 arrow <- arrow(length = unit(0.4, "cm"), type = "closed")
@@ -137,7 +146,7 @@ The facet and layout implementation has been moved to ggproto and received a lar
137146 aligned according to the plot area and a box can be drawn around all legends:
138147
139148 ```{r}
140- ggplot(mpg, aes(displ, hwy, shape = drv, colour = class )) +
149+ ggplot(mpg, aes(displ, hwy, shape = drv, colour = fl )) +
141150 geom_point() +
142151 theme(
143152 legend.justification = "top",
@@ -166,7 +175,7 @@ The facet and layout implementation has been moved to ggproto and received a lar
166175
167176## Stacking bars
168177
169- `position_stack()` and `position_fill()` now stacks values in the reverse
178+ `position_stack()` and `position_fill()` now stack values in the reverse
170179order of the grouping, which makes the default stack order match the legend.
171180
172181```{r}
@@ -183,7 +192,7 @@ ggplot(avg_price) +
183192(Note also the new ` geom_col() ` which is short-hand for
184193` geom_bar(stat = "identity") ` , contributed by Bob Rudis.)
185194
186- Furthermore , you can now stack negative values:
195+ Additionally , you can now stack negative values:
187196
188197``` {r}
189198ggplot(avg_price) +
@@ -193,7 +202,7 @@ ggplot(avg_price) +
193202The overall ordering cannot necessarily be matched in the presence of
194203negative values, but the ordering on either side of the x-axis will match.
195204
196- If you want to stack in the opposite, order try
205+ If you want to stack in the opposite order, try
197206[ ` forcats::fct_rev() ` ] ( http://forcats.tidyverse.org/reference/fct_rev.html ) :
198207
199208``` {r}
0 commit comments