#' Draw PERU histogram.
#'
#' @param data
#' @param x
#' @param ... - all parameters from geom_hist and theme_peru
#' @examples
#' \dontrun{
#' peru_hist(diamonds, x)
#' peru_hist(diamonds, x, binwidth = 0.1)
#' peru_hist(diamonds, x, breaks = seq(5,6,0.01))
#' }
#
# peru_hist <- function(data, x, ...) {
# # get what geom_point accepts
# geom_hist_aes <- c("x", "y", "alpha", "colour", "color", "fill", "shape", "size", "stroke")
# hist_params <- unique(c(geom_hist_aes,
# names(formals(stat_bin)),
# names(formals(layer))))
#
# # get what scale_y_continuous accepts
# theme_peru_params <- unique(names(formals(theme_peru)))
#
# gg <- ggplot(data = data, aes_(substitute(x)))
# base_args <- list(fill = categorical_colors[1], color = "white")
#
# args <- list(...)
# args <- c(args, base_args)
#
# # get all the arg names
# arg_names <- unique(names(args))
#
# gg <- gg + do.call(stat_bin,
# sapply(intersect(arg_names, hist_params),
# function(x) { list(args[[x]]) }))
#
# # which ones are left for theme_peru
# gg <- gg + do.call(theme_peru,
# sapply(intersect(arg_names, theme_peru_params),
# function(x) { list(args[[x]]) }))
#
# return(gg)
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.