Skip to content

Commit 4299917

Browse files
yutannihilationhadley
authored andcommitted
Add documentation about labs(tag = ) (#2663)
* add descriptions about tag * close a parenthesis
1 parent 439a41b commit 4299917

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

R/labels.r

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ update_labels <- function(p, labels) {
2222
#' audience. Ensure the axis and legend labels display the full variable name.
2323
#' Use the plot `title` and `subtitle` to explain the main findings.
2424
#' It's common to use the `caption` to provide information about the
25-
#' data source.
25+
#' data source. `tag` can be used for adding identification tags.
2626
#'
2727
#' You can also set axis and legend labels in the individual scales (using
28-
#' the first argument, the `name`. I recommend doing that if you're
28+
#' the first argument, the `name`). I recommend doing that if you're
2929
#' changing other scale options.
3030
#'
3131
#' @param label The text for the axis, plot title or caption below the plot.
3232
#' @param subtitle the text for the subtitle for the plot which will be
3333
#' displayed below the title. Leave `NULL` for no subtitle.
3434
#' @param ... A list of new name-value pairs. The name should either be
35-
#' an aesthetic, or one of "title", "subtitle", or "caption".
35+
#' an aesthetic, or one of "title", "subtitle", "caption", or "tag".
3636
#' @export
3737
#' @examples
3838
#' p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point()
@@ -47,6 +47,10 @@ update_labels <- function(p, labels) {
4747
#' # The caption appears in the bottom-right, and is often used for
4848
#' # sources, notes or copyright
4949
#' p + labs(caption = "(based on data from ...)")
50+
#'
51+
#' # The plot tag appears at the top-left, and is typically used
52+
#' # for labelling a subplot with a letter.
53+
#' p + labs(title = "title", tag = "A")
5054
labs <- function(...) {
5155
args <- list(...)
5256
if (is.list(args[[1]])) args <- args[[1]]

man/labs.Rd

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

0 commit comments

Comments
 (0)