Skip to content

Commit

Permalink
fixed copypaste error
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinTh committed Dec 13, 2017
1 parent aa07071 commit 39c9ef8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/scales.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,24 @@ ochre_pal <- function(palette="namatjira_qual", alpha = 1, reverse = FALSE) {
#' library(ggplot2)
#' ggplot(mtcars, aes(mpg, wt)) +
#' geom_point(aes(colour = factor(cyl))) +
#' scale_colour_ochre(palette="olsen_qual")
#' scale_colour_ochre(palette="jumping_frog")
#' ggplot(mtcars, aes(mpg, wt)) +
#' geom_point(aes(colour = hp)) +
#' scale_colour_ochre(palette="olsen_qual", discrete = FALSE)
#' ggplot(data = mpg) +
#' geom_point(mapping = aes(x = displ, y = hwy, color = class)) +
#' scale_colour_ochre(palette="winmar")
#' ggplot(diamonds) + geom_bar(aes(x = cut, fill = clarity)) +
#' scale_fill_ochre()
#' scale_fill_ochre("jumping_frog")
#' @export
#'
#' @importFrom ggplot2 discrete_scale scale_color_gradientn
scale_color_ochre <- function(..., palette="namatjira_qual",
discrete = TRUE, alpha = 1, reverse = FALSE) {
if (discrete) {
discrete_scale("colour", "ochre", palette=ochre_pal(palette, alpha = alpha, reverse = reverse))
discrete_scale("colour", "ochre", palette=ochre_pal(palette,
alpha = alpha,
reverse = reverse))
} else {
scale_color_gradientn(colours = ochre_pal(palette, alpha = alpha, reverse = reverse, ...)(256))
}
Expand All @@ -78,7 +80,7 @@ scale_colour_ochre <- scale_color_ochre
#'
#' @param discrete whether to use a discrete colour palette
#'
#' @param ... additional arguments to pass to scale_color_gradientn
#' @param ... additional arguments to pass to scale_fill_gradientn
#'
#' @importFrom ggplot2 scale_fill_manual discrete_scale scale_fill_gradientn
#'
Expand Down

0 comments on commit 39c9ef8

Please sign in to comment.