Skip to content

Add documentation about labs(tag = ) #2663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions R/labels.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ update_labels <- function(p, labels) {
#' audience. Ensure the axis and legend labels display the full variable name.
#' Use the plot `title` and `subtitle` to explain the main findings.
#' It's common to use the `caption` to provide information about the
#' data source.
#' data source. `tag` can be used for adding identification tags.
#'
#' You can also set axis and legend labels in the individual scales (using
#' the first argument, the `name`. I recommend doing that if you're
#' the first argument, the `name`). I recommend doing that if you're
#' changing other scale options.
#'
#' @param label The text for the axis, plot title or caption below the plot.
#' @param subtitle the text for the subtitle for the plot which will be
#' displayed below the title. Leave `NULL` for no subtitle.
#' @param ... A list of new name-value pairs. The name should either be
#' an aesthetic, or one of "title", "subtitle", or "caption".
#' an aesthetic, or one of "title", "subtitle", "caption", or "tag".
#' @export
#' @examples
#' p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point()
Expand All @@ -47,6 +47,10 @@ update_labels <- function(p, labels) {
#' # The caption appears in the bottom-right, and is often used for
#' # sources, notes or copyright
#' p + labs(caption = "(based on data from ...)")
#'
#' # The plot tag appears at the top-left, and is typically used
#' # for labelling a subplot with a letter.
#' p + labs(title = "title", tag = "A")
labs <- function(...) {
args <- list(...)
if (is.list(args[[1]])) args <- args[[1]]
Expand Down
10 changes: 7 additions & 3 deletions man/labs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.