Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (24 sloc) 0.784 kb
#' Modify geom/stat aesthetic defaults for future plots
#'
#' @param stat,geom name of geom/stat to modify
#' @param new named list of aesthetics
#' @export
#' @examples
#' update_geom_defaults("point", list(colour = "darkblue"))
#' qplot(mpg, wt, data = mtcars)
#' update_geom_defaults("point", list(colour = "black"))
#' @rdname update_defaults
update_geom_defaults <- function(geom, new) {
g <- Geom$find(geom)
old <- g$default_aes()
aes <- defaults(new, old)
g$default_aes <- eval(substitute(function(.) aes, list(aes = aes)))
}
#' @rdname update_defaults
#' @export
update_stat_defaults <- function(stat, new) {
g <- Stat$find(geom)
old <- g$default_aes()
aes <- defaults(new, old)
g$default_aes <- eval(substitute(function(.) aes, list(aes = aes)))
}
Jump to Line
Something went wrong with that request. Please try again.