R/scale_percentage.R

Defines functions scale_x_percent scale_y_percent scale_xy_percent

#' Percentage scales
#'
#' Format the labels on the x axis, y axis, or both
#'
#' @param ... Arguments passed on to the scales
#'
#' @name scale_percent
#'
#' @export
scale_x_percent <- function(...) {
    ggplot2::scale_x_continuous(..., labels = scales::percent_format())
}


#' @rdname scale_percent
#' @export
scale_y_percent <- function(...) {
    ggplot2::scale_y_continuous(..., labels = scales::percent_format())
}


#' @rdname scale_percent
#' @export
scale_xy_percent <- function(...) {
    list(scale_x_percent(...), scale_y_percent(...))
}
MikhaelManurung/mdmisc documentation built on March 19, 2020, 1:12 a.m.