#' 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(...))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.