Nothing
#' ggplot2 demo
#'
#' @param x a numeric
#' @param scale_name scale name
#' @param ... further arguments to be passed to the scale
#'
#' @return A `ggplot` object, invisibly printed as a demo of the requested
#' scale.
#'
#' @export
#'
#' @examples
#' demo_number(c(32, 212), scale_name = "number_locale")
demo_number <- function(x, scale_name, ...) {
demo_ggplot(x, paste("scale", "x", scale_name, sep = "_"), ...)
}
demo_ggplot <- function(x, scale_name, ...) {
call <- substitute(list(...))
call[[1]] <- as.name(scale_name)
message(paste0(deparse(call), collapse = ""))
scale <- getExportedValue("countryscales", scale_name)
df <- data.frame(x = x, stringsAsFactors = FALSE)
ggplot2::ggplot(df, ggplot2::aes(x, 1)) +
ggplot2::geom_blank() +
scale(NULL, ...) +
ggplot2::scale_y_continuous(NULL,
breaks = NULL
) +
ggplot2::theme(aspect.ratio = 1 / 5)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.