@@ -210,33 +210,69 @@ All defunct functions have been removed.
210
210
211
211
### Labelling
212
212
213
- * `facet_wrap()` gains a `labeller` option (@lionel-, #25).
214
-
215
- * The labeller API has been updated to offer more control when facetting over
216
- multiple factors (e.g. with formulae such as `~cyl + am`). Previously, a
217
- labeller function would take `variable` and `value` arguments and return a
218
- character vector.
219
-
220
- Now, they take a data frame of character vectors and return a list. The input
221
- data frame has one column per factor facetted over. Each column in the
222
- returned list becomes one line in the strip label. See documentation for more
223
- details.
224
-
225
- * Labellers offer the `multi_line` argument to control whether to display one
226
- or multiple lines.
227
-
228
- * Referring to `x` in backquoted expressions with `label_bquote()` is
229
- deprecated. You can now refer to the variable names instead. (@lionel-)
230
-
231
- * `label_bquote()` and `labeller()` now take `rows` and `cols` arguments. They
232
- allow rows and columns labels to have specific plotmath expressions or
233
- labellers.
234
-
235
- * New labeller `label_context()` which behaviour differently based on the
236
- on the number of factors facetted over. With a single factor, it displays
237
- only the values, just as before. But with multiple factors (e.g. with
238
- `~cyl + am`), the labels are dispatched to `label_both()` to display both the
239
- variables and the values and make the plot clearer. (@lionel-)
213
+ The facet labelling system was updated with many new features and a
214
+ more flexible interface (@lionel-). It now works consistently across
215
+ grid and wrap facets. The most important user visible changes are:
216
+
217
+ * `facet_wrap()` gains a `labeller` option (#25).
218
+
219
+ * `facet_grid()` and `facet_wrap()` gain a `switch` argument to
220
+ display the facet titles near the axes. When switched, the labels
221
+ become axes subtitles. `switch` can be set to "x", "y" or "both"
222
+ (the latter only for grids) to control which margin is switched.
223
+
224
+ The labellers (such as `label_value()` or `label_both()`) also get
225
+ some new features:
226
+
227
+ * They now offer the `multi_line` argument to control whether to
228
+ display composite facets (those specified as `~var1 + var2`) on one
229
+ or multiple lines.
230
+
231
+ * In `label_bquote()` you now refer directly to the names of
232
+ variables. With this change, you can create math expressions that
233
+ depend on more than one variable. This math expression can be
234
+ specified either for the rows or the columns and you can also
235
+ provide different expressions to each margin.
236
+
237
+ As a consequence of these changes, referring to `x` in backquoted
238
+ expressions is deprecated.
239
+
240
+ * Similarly to `label_bquote()`, `labeller()` now take `.rows` and
241
+ `.cols` arguments. In addition, it also takes `.default`.
242
+ `labeller()` is useful to customise how particular variables are
243
+ labelled. The three additional arguments specify how to label the
244
+ variables are not specifically mentioned, respectively for rows,
245
+ columns or both. This makes it especially easy to set up a
246
+ project-wide labeller dispatcher that can be reused across all your
247
+ plots. See the documentation for an example.
248
+
249
+ * The new labeller `label_context()` adapts to the number of factors
250
+ facetted over. With a single factor, it displays only the values,
251
+ just as before. But with multiple factors in a composite margin
252
+ (e.g. with `~cyl + am`), the labels are passed over to
253
+ `label_both()`. This way the variables names are displayed with the
254
+ values to help identifying them.
255
+
256
+ On the programming side, the labeller API has been rewritten in order
257
+ to offer more control when facetting over multiple factors (e.g. with
258
+ formulae such as `~cyl + am`). This also means that if you have
259
+ written custom labellers, you will need to update them for this
260
+ version of ggplot.
261
+
262
+ * Previously, a labeller function would take `variable` and `value`
263
+ arguments and return a character vector. Now, they take a data frame
264
+ of character vectors and return a list. The input data frame has one
265
+ column per factor facetted over and each column in the returned list
266
+ becomes one line in the strip label. See documentation for more
267
+ details.
268
+
269
+ * The labels received by a labeller now contain metadata: their margin
270
+ (in the "type" attribute) and whether they come from a wrap or a
271
+ grid facet (in the "facet" attribute).
272
+
273
+ * Note that the new `as_labeller()` function operator provides an easy
274
+ way to transform an existing function to a labeller function. The
275
+ existing function just needs to take and return a character vector.
240
276
241
277
## Documentation
242
278
@@ -321,11 +357,6 @@ All defunct functions have been removed.
321
357
* `facet_wrap()` and `facet_grid()` now allow you to use non - standard
322
358
variable names by surrounding them with backticks (# 1067).
323
359
324
- * `facet_grid()` and `facet_wrap()` gain a `switch` argument that
325
- allows the facet titles to be displayed near the axes. They then act
326
- as axes subtitles. Can be set to " x" , " y" or " both" (the latter only
327
- for grids ) to control which label strips are switched. (@ lionel - )
328
-
329
360
* `facet_wrap()` more carefully checks its `nrow` and `ncol` arguments
330
361
to ensure that they ' re specified correctly (@richierocks, #962)
331
362
0 commit comments