|
8 | 8 |
|
9 | 9 | * `facet_wrap()` and `facet_grid()` now support `vars()` inputs. Like
|
10 | 10 | `dplyr::vars()`, this helper quotes its inputs and supports
|
11 |
| - quasiquotation. For instance, you can now supply facetting variables |
| 11 | + quasiquotation. For instance, you can now supply faceting variables |
12 | 12 | like this: `facet_wrap(vars(am, cyl))` instead of
|
13 | 13 | `facet_wrap(~am + cyl)`. Note that the formula interface is not going
|
14 | 14 | away and will not be deprecated. `vars()` is simply meant to make it
|
|
35 | 35 | ggplot(nc) +
|
36 | 36 | geom_sf(aes(fill = AREA))
|
37 | 37 | ```
|
38 |
| - It supports all simple features, automatically aligns CRS across layer, sets |
39 |
| - up correct aspect ratio, and draws a graticule. |
| 38 | + It supports all simple features, automatically aligns CRS across layers, sets |
| 39 | + up the correct aspect ratio, and draws a graticule. |
40 | 40 |
|
41 | 41 | ## New features
|
42 | 42 |
|
|
51 | 51 | with documentation which hopefully will make this part of ggplot2 less
|
52 | 52 | confusing (#2059).
|
53 | 53 |
|
54 |
| - `calc()` is particularly nice for more complex calculation because you |
55 |
| - only need to specify once: `aes(y = calc(count / max(count)))`, |
| 54 | + `calc()` is particularly nice for more complex calculations because you |
| 55 | + only need to specify it once: `aes(y = calc(count / max(count)))`, |
56 | 56 | rather than `aes(y = ..count.. / max(..count..))`
|
57 | 57 |
|
58 |
| -* New `tag` label for adding identification tags to the plot, typically used |
59 |
| - for labelling a subplot with a letter. Add a tag with with `labs(tag = "A")`, |
60 |
| - style it with the `plot.tag` theme element, and control position with the |
| 58 | +* New `tag` label for adding identification tags to plots, typically used for |
| 59 | + labelling a subplot with a letter. Add a tag with `labs(tag = "A")`, style it |
| 60 | + with the `plot.tag` theme element, and control position with the |
61 | 61 | `plot.tag.position` theme setting (@thomasp85).
|
62 | 62 |
|
63 | 63 | ### Layers: geoms, stats, and position adjustments
|
|
67 | 67 | (@hrbrmstr and @clauswilke, #2375).
|
68 | 68 |
|
69 | 69 | * `geom_point()` and friends can now take shapes as strings instead of integers,
|
70 |
| - e.g. `geom_point(shape = "diamond")` (@daniel-barnett, #2075). |
| 70 | + e.g. `geom_point(shape = "diamond")` (@daniel-barnett, #2075). |
71 | 71 |
|
72 |
| -* `position_dodge()` gains an `preserve` argument that allows you to control |
| 72 | +* `position_dodge()` gains a `preserve` argument that allows you to control |
73 | 73 | whether the `total` width at each `x` value is preserved (the current
|
74 | 74 | default), or ensure that the width of a `single` element is preserved
|
75 | 75 | (what many people want) (#1935).
|
76 | 76 |
|
77 |
| -* New `position_dodge2()` provides enhanced dogding for boxplots. Compared to |
| 77 | +* New `position_dodge2()` provides enhanced dodging for boxplots. Compared to |
78 | 78 | `position_dodge()`, `position_dodge2()` compares `xmin` and `xmax` values
|
79 |
| - to determin which elements overlap, spreading overlapping elements evenly |
| 79 | + to determine which elements overlap, and spreads overlapping elements evenly |
80 | 80 | within the region of overlap. `position_dodge2()` is now the default position
|
81 |
| - adjustment for `geom_boxplot()`, since it handles `varwidth = TRUE`, and |
82 |
| - it will be considered for other geoms in future. |
| 81 | + adjustment for `geom_boxplot()`, because it handles `varwidth = TRUE`, and |
| 82 | + will be considered for other geoms in the future. |
83 | 83 |
|
84 | 84 | The `padding` parameter adds a small amount of padding between elements
|
85 | 85 | (@karawoo, #2143) and a `reverse` parameter allows you to reverse the order
|
86 | 86 | of placement (@karawoo, #2171).
|
87 | 87 |
|
88 |
| -* New `stat_qq_line()` makes it easy to add a simple line to a Q-Q plot. This |
89 |
| - line makes it easier to judge the fit of the theoretical distribution |
| 88 | +* New `stat_qq_line()` makes it easy to add a simple line to a Q-Q plot, which |
| 89 | + makes it easier to judge the fit of the theoretical distribution |
90 | 90 | (@nicksolomon).
|
91 | 91 |
|
92 | 92 | ### Scales and guides
|
|
97 | 97 |
|
98 | 98 | * Improved support for ordered factors. Ordered factors throw a warning when
|
99 | 99 | mapped to shape (unordered factors do not), and do not throw warnings when
|
100 |
| - mapped to size or alpha (unordered factors do). Viridis is used as default |
101 |
| - colour and fill scale for ordered factors (@karawoo, #1526). |
| 100 | + mapped to size or alpha (unordered factors do). Viridis is used as the |
| 101 | + default colour and fill scale for ordered factors (@karawoo, #1526). |
102 | 102 |
|
103 | 103 | * The `expand` argument of `scale_*_continuous()` and `scale_*_discrete()`
|
104 | 104 | now accepts separate expansion values for the lower and upper range
|
105 | 105 | limits. The expansion limits can be specified using the convenience
|
106 | 106 | function `expand_scale()`.
|
107 | 107 |
|
108 | 108 | Separate expansion limits may be useful for bar charts, e.g. if one
|
109 |
| - wants to have the bottom of the bars being flush with the x axis but |
110 |
| - still leave some (automatically calculated amount of) space above them: |
| 109 | + wants the bottom of the bars to be flush with the x axis but still |
| 110 | + leave some (automatically calculated amount of) space above them: |
111 | 111 |
|
112 | 112 | ```r
|
113 | 113 | ggplot(mtcars) +
|
|
117 | 117 |
|
118 | 118 | It can also be useful for line charts, e.g. for counts over time,
|
119 | 119 | where one wants to have a ’hard’ lower limit of y = 0 but leave the
|
120 |
| - upper limit unspecified (and perhaps differing between panels), |
121 |
| - but with some extra space above the highest point on the line. |
122 |
| - (With symmetrical limits, the extra space above the highest point |
123 |
| - could in some cases cause the lower limit to be negative). |
| 120 | + upper limit unspecified (and perhaps differing between panels), with |
| 121 | + some extra space above the highest point on the line (with symmetrical |
| 122 | + limits, the extra space above the highest point could in some cases |
| 123 | + cause the lower limit to be negative). |
124 | 124 |
|
125 | 125 | The old syntax for the `expand` argument will, of course, continue
|
126 |
| - to work. (@huftis, #1669) |
| 126 | + to work (@huftis, #1669). |
127 | 127 |
|
128 | 128 | * `scale_colour_continuous()` and `scale_colour_gradient()` are now controlled
|
129 | 129 | by global options `ggplot2.continuous.colour` and `ggplot2.continuous.fill`.
|
|
146 | 146 | at all angles (@karawoo).
|
147 | 147 |
|
148 | 148 | * Strip labels now understand justification relative to the direction of the
|
149 |
| - text, meaning that in y facets the strip text can be placed at either end of |
| 149 | + text, meaning that in y facets, the strip text can be placed at either end of |
150 | 150 | the strip using `hjust` (@karawoo).
|
151 | 151 |
|
152 |
| -* Legend titles and labels get a little extra space around them. Legend titles |
153 |
| - will no longer overlap the legend at large font sizes (@karawoo, #1881). |
| 152 | +* Legend titles and labels get a little extra space around them, which |
| 153 | + prevents legend titles from overlapping the legend at large font sizes |
| 154 | + (@karawoo, #1881). |
154 | 155 |
|
155 | 156 | ## Extension points
|
156 | 157 |
|
|
161 | 162 | defined for the class of the object (@thomasp85).
|
162 | 163 |
|
163 | 164 | * Theme elements can now be subclassed. Add a `merge_element` method to control
|
164 |
| - how properties are inherited from parent element. Add an `element_grob` |
| 165 | + how properties are inherited from the parent element. Add an `element_grob` |
165 | 166 | method to define how elements are rendered into grobs (@thomasp85, #1981).
|
166 | 167 |
|
167 | 168 | * Coords have gained new extension mechanisms.
|
168 | 169 |
|
169 |
| - If you have an existing coord extension you will need to revise the |
| 170 | + If you have an existing coord extension, you will need to revise the |
170 | 171 | specification of the `train()` method. It is now called
|
171 | 172 | `setup_panel_params()` (better reflecting what it actually does) and now
|
172 | 173 | has arguments `scale_x`, and `scale_y` (the x and y scales respectively)
|
|
200 | 201 | e.g. `as.numeric(scale(x))`.
|
201 | 202 |
|
202 | 203 | * The function `guide_train()` now has an optional parameter `aesthetic`
|
203 |
| - that allows to override the `aesthetic` setting in the scale. This change |
204 |
| - will only affect code that implements custom guides (@clauswilke). |
| 204 | + that allows you to override the `aesthetic` setting in the scale. This |
| 205 | + change will only affect code that implements custom guides (@clauswilke). |
205 | 206 |
|
206 | 207 | ## Minor bug fixes and improvements
|
207 | 208 |
|
208 |
| -### Facetting |
| 209 | +### Faceting |
209 | 210 |
|
210 | 211 | * `facet_grid()` gives a more informative error message if you try to use
|
211 | 212 | a variable in both rows and cols (#1928).
|
|
221 | 222 |
|
222 | 223 | ### Scales
|
223 | 224 |
|
224 |
| -* `discrete_scale()` documentation updated to match `continuous_scale()` |
225 |
| - (@alistaire47, #2052). |
| 225 | +* `discrete_scale()` documentation now inherits shared definitions from |
| 226 | + `continuous_scale()` (@alistaire47, #2052). |
226 | 227 |
|
227 |
| -* `guide_colorbar()` shows all colours of the scale (@has2k1, 2343). |
| 228 | +* `guide_colorbar()` shows all colours of the scale (@has2k1, #2343). |
228 | 229 |
|
229 | 230 | * `scale_identity()` once again produces legends by default (#2112).
|
230 | 231 |
|
231 |
| -* Fixed bug in secondary axis that would lead to incorrectly placed ticks with |
232 |
| - strong transforms (@thomasp85, #1992). |
| 232 | +* Tick marks for secondary axes with strong transformations are more |
| 233 | + accurately placed (@thomasp85, #1992). |
233 | 234 |
|
234 | 235 | * Missing line types now reliably generate missing lines (with standard
|
235 | 236 | warning) (#2206).
|
236 | 237 |
|
237 |
| -* Legends no longer try and use set aesthetics that are not length one (#1932). |
| 238 | +* Legends now ignore set aesthetics that are length one (#1932). |
238 | 239 |
|
239 | 240 | * All colour and fill scales now have an `aesthetics` argument that can
|
240 | 241 | be used to set the aesthetic(s) the scale works with. This makes it
|
241 | 242 | possible to apply a colour scale to both colour and fill aesthetics
|
242 | 243 | at the same time, via `aesthetics = c("colour", "fill")` (@clauswilke).
|
243 | 244 |
|
244 |
| -* Three generic scales were added that work with any aesthetic or set of |
245 |
| - aesthetics: `scale_continuous_identity()`, `scale_discrete_identity()`, and |
| 245 | +* Three new generic scales work with any aesthetic or set of aesthetics: |
| 246 | + `scale_continuous_identity()`, `scale_discrete_identity()`, and |
246 | 247 | `scale_discrete_manual()` (@clauswilke).
|
247 | 248 |
|
248 |
| -* Fixed bug in `scale_*_gradient2()` where points outside limits can sometimes |
249 |
| - reappear due to rescaling. Now, any rescaling is performed after the limits |
250 |
| - are enforced (@foo-bar-baz-qux, #2230). |
| 249 | +* `scale_*_gradient2()` now consistently omits points outside limits by |
| 250 | + rescaling after the limits are enforced (@foo-bar-baz-qux, #2230). |
251 | 251 |
|
252 | 252 | ### Layers
|
253 | 253 |
|
254 |
| -* `geom_label()` no longer produces an undesired border around labels when |
255 |
| - `label.size` is 0, even when saving to PDF (@bfgray3, #2407). |
| 254 | +* `geom_label()` now correctly produces unbordered labels when `label.size` |
| 255 | + is 0, even when saving to PDF (@bfgray3, #2407). |
256 | 256 |
|
257 | 257 | * `layer()` gives considerably better error messages for incorrectly specified
|
258 | 258 | `geom`, `stat`, or `position` (#2401).
|
259 | 259 |
|
260 | 260 | * In all layers that use it, `linemitre` now defaults to 10 (instead of 1)
|
261 | 261 | to better match base R.
|
262 | 262 |
|
263 |
| -* `geom_boxplot()` now supplies default value if no `x` aesthetic present |
| 263 | +* `geom_boxplot()` now supplies a default value if no `x` aesthetic is present |
264 | 264 | (@foo-bar-baz-qux, #2110).
|
265 | 265 |
|
266 | 266 | * `geom_density()` drops groups with fewer than two data points and throws a
|
267 |
| - warning. For groups with two data points, the density values are now |
268 |
| - calculated with `stats::density` (@karawoo, #2127). |
| 267 | + warning. For groups with two data points, density values are now calculated |
| 268 | + with `stats::density` (@karawoo, #2127). |
269 | 269 |
|
270 | 270 | * `geom_segment()` now also takes a `linejoin` parameter. This allows more
|
271 | 271 | control over the appearance of the segments, which is especially useful for
|
272 | 272 | plotting thick arrows (@Ax3man, #774).
|
273 | 273 |
|
274 | 274 | * `geom_smooth()` now reports the formula used when `method = "auto"`
|
275 |
| - (@davharris #1951). When mgcv is used, the the `s` in `y ~ s(x, bs = "cs")` |
276 |
| - is now fully qualified as `mgcv::s()` to name conflicts (@bfgray3, #2535). |
277 |
| - `geom_smooth()` now orders by the `x` aesthetic, making it easier |
278 |
| - to pass pre-computed values without manual ordering (@izahn, #2028). |
279 |
| - It also now knows it has `ymin` and `ymax` aesthetics (#1939). |
280 |
| - The legend correctly reflects the status of the `se` argument when used |
281 |
| - with stats other than the default (@clauswilke, #1546). |
| 275 | + (@davharris #1951). When mgcv is used, the `s` in `y ~ s(x, bs = "cs")` |
| 276 | + is now fully qualified as `mgcv::s()` to avoid name conflicts (@bfgray3, |
| 277 | + #2535). `geom_smooth()` now orders by the `x` aesthetic, making it easier |
| 278 | + to pass pre-computed values without manual ordering (@izahn, #2028). It |
| 279 | + also now knows it has `ymin` and `ymax` aesthetics (#1939). The legend |
| 280 | + correctly reflects the status of the `se` argument when used with stats |
| 281 | + other than the default (@clauswilke, #1546). |
282 | 282 |
|
283 | 283 | * `geom_tile()` now once again interprets `width` and `height` correctly
|
284 | 284 | (@malcolmbarrett, #2510).
|
|
295 | 295 | * `stat_bin()` now accepts functions for `binwidth`. This allows better binning
|
296 | 296 | when faceting along variables with different ranges (@botanize).
|
297 | 297 |
|
298 |
| -* `stat_bin()` / `geom_histogram()` no longer sum incorrectly when using the |
299 |
| - `weight` aesthetic (@jiho, #1921). |
| 298 | +* `stat_bin()` and `geom_histogram()` now sum correctly when using the `weight` |
| 299 | + aesthetic (@jiho, #1921). |
300 | 300 |
|
301 |
| -* `stat_bin()` uses correct scaling for computed variable `ndensity` |
| 301 | +* `stat_bin()` again uses correct scaling for the computed variable `ndensity` |
302 | 302 | (@timgoodman, #2324).
|
303 | 303 |
|
304 | 304 | * `stat_bin()` and `stat_bin_2d()` now properly handle the `breaks` parameter
|
|
310 | 310 | * The `show.legend` parameter now accepts a named logical vector to hide/show
|
311 | 311 | only some aesthetics in the legend (@tutuchan, #1798).
|
312 | 312 |
|
313 |
| -* Layers no longer warn about unknown aesthetics with value `NULL` (#1909). |
| 313 | +* Layers now silently ignore unknown aesthetics with value `NULL` (#1909). |
314 | 314 |
|
315 | 315 | ### Coords
|
316 | 316 |
|
|
319 | 319 | (@clauswilke, #2536).
|
320 | 320 |
|
321 | 321 | * Like scales, coordinate systems now give you a message when you're
|
322 |
| - replacing an existing coordiante system (#2264). |
| 322 | + replacing an existing coordinate system (#2264). |
323 | 323 |
|
324 | 324 | * `coord_polar()` now draws secondary axis ticks and labels
|
325 | 325 | (@dylan-stark, #2072), and can draw the radius axis on the right
|
|
388 | 388 |
|
389 | 389 | * `ggsave()`'s DPI argument now supports 3 string options: "retina" (320
|
390 | 390 | DPI), "print" (300 DPI), and "screen" (72 DPI) (@foo-bar-baz-qux, #2156).
|
391 |
| - `ggsave()` no longer partially matches graphic device parameters (#2355), |
392 |
| - and correctly restores the previous graphics device when several |
| 391 | + `ggsave()` now uses full argument names to avoid partial match warnings |
| 392 | + (#2355), and correctly restores the previous graphics device when several |
393 | 393 | graphics devices are open (#2363).
|
394 | 394 |
|
395 | 395 | * `print.ggplot()` now returns the original ggplot object, instead of the
|
|
399 | 399 | * `map_data()` now works even when purrr is loaded (tidyverse#66).
|
400 | 400 |
|
401 | 401 | * New functions `summarise_layout()`, `summarise_coord()`, and
|
402 |
| - `summarise_layers()` summarise the layout, coordinate systems, and layers, |
| 402 | + `summarise_layers()` summarise the layout, coordinate systems, and layers |
403 | 403 | of a built ggplot object (#2034, @wch). This provides a tested API that
|
404 | 404 | (e.g.) shiny can depend on.
|
405 | 405 |
|
|
0 commit comments