Skip to content

Commit dd5ab42

Browse files
committed
Doc tweaks for facets
1 parent 66aeee5 commit dd5ab42

12 files changed

+45
-25
lines changed

R/facet-grid-.r

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#' @include facet-.r
22
NULL
33

4-
#' Lay out panels in a grid.
4+
#' Lay out panels in a grid
5+
#'
6+
#' \code{facet_grid} forms a matrix of panels defined by row and column
7+
#' facetting variables. It is most useful when you have two discrete
8+
#' variables, and all combinations of the variables exist in the data.
59
#'
610
#' @param facets a formula with the rows (of the tabular display) on the LHS
711
#' and the columns (of the tabular display) on the RHS; the dot in the

R/facet-null.r

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ NULL
44
#' Facet specification: a single panel.
55
#'
66
#' @inheritParams facet_grid
7+
#' @keywords internal
78
#' @export
89
#' @examples
910
#' # facet_null is the default facetting specification if you

R/facet-wrap.r

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#' @include facet-.r
22
NULL
33

4-
#' Wrap a 1d ribbon of panels into 2d.
4+
#' Wrap a 1d ribbon of panels into 2d
55
#'
6-
#' Most displays are roughly rectangular, so if you have a categorical
7-
#' variable with many levels, it doesn't make sense to try and display them
8-
#' all in one row (or one column). To solve this dilemma, \code{facet_wrap}
9-
#' wraps a 1d sequence of panels into 2d, making best use of screen real estate.
6+
#' \code{facet_wrap} wraps a 1d sequence of panels into 2d. This is generally
7+
#' a better use of screen space than \code{\link{facet_grid}} because most
8+
#' displays are roughly rectangular.
109
#'
1110
#' @param facets Either a formula or character vector. Use either a
1211
#' one sided formula, \code{~a + b}, or a character vector, \code{c("a", "b")}.

R/labeller.r

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Labeller functions
1+
#' Useful labeller functions
22
#'
33
#' Labeller functions are in charge of formatting the strip labels of
44
#' facet grids and wraps. Most of them accept a \code{multi_line}
@@ -65,7 +65,6 @@
6565
#' @family facet
6666
#' @seealso \code{\link{labeller}()}, \code{\link{as_labeller}()},
6767
#' \code{\link{label_bquote}()}
68-
#' @name labellers
6968
#' @examples
7069
#' mtcars$cyl2 <- factor(mtcars$cyl, labels = c("alpha", "beta", "gamma"))
7170
#' p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
@@ -87,6 +86,8 @@
8786
#' p + facet_grid(. ~ cyl2, labeller = label_parsed)
8887
#' p + facet_wrap(~vs + cyl2, labeller = label_parsed)
8988
#' }
89+
#' @name labellers
90+
#' @aliases NULL
9091
NULL
9192

9293
collapse_labels_lines <- function(labels) {
@@ -178,11 +179,12 @@ find_names <- function(expr) {
178179
}
179180
}
180181

181-
#' Backquoted labeller
182+
#' Label with mathematical expressions
182183
#'
183-
#' \code{\link{label_bquote}()} offers a flexible way of labelling
184+
#' \code{label_bquote()} offers a flexible way of labelling
184185
#' facet rows or columns with plotmath expressions. Backquoted
185186
#' variables will be replaced with their value in the facet.
187+
#'
186188
#' @param rows Backquoted labelling expression for rows.
187189
#' @param cols Backquoted labelling expression for columns.
188190
#' @param default Default labeller function for the rows or the
@@ -281,6 +283,7 @@ resolve_labeller <- function(rows, cols, labels) {
281283
#' @param default Default labeller to process the labels produced by
282284
#' lookup tables or modified by non-labeller functions.
283285
#' @seealso \code{\link{labeller}()}, \link{labellers}
286+
#' @keywords internal
284287
#' @export
285288
#' @examples
286289
#' p <- ggplot(mtcars, aes(disp, drat)) + geom_point()
@@ -322,7 +325,7 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) {
322325
structure(fun, class = "labeller")
323326
}
324327

325-
#' Generic labeller function for facets
328+
#' Construct labelling specification
326329
#'
327330
#' This function makes it easy to assign different labellers to
328331
#' different factors. The labeller can be a function or it can be a

_pkgdown.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,22 @@ reference:
6464
- starts_with("scale_")
6565

6666
- title: Facetting
67+
desc: >
68+
Facetting generates small multiples, each displaying a different
69+
subset of the data. Facets are an alternative to aesthetics for
70+
displaying additional discrete variables.
71+
contents:
72+
- facet_grid
73+
- facet_wrap
74+
75+
- title: "Facetting: labels"
76+
desc: >
77+
These functions provide a flexible toolkit for controlling the display
78+
of the "strip" labels on facets.
6779
contents:
68-
- starts_with("facet_")
6980
- labeller
7081
- labellers
71-
- as_labeller
82+
- label_value
7283
- label_bquote
7384

7485
- title: Coordinate systems

man/as_labeller.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/facet_grid.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/facet_null.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/facet_wrap.Rd

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/label_bquote.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)