Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use colorbar guide as default for continuous color/fill scale (fixes #…

  • Loading branch information...
commit acfc4dd27965c165a52032966bf48084d5c21c18 1 parent 407fa0f
@kohske authored
Showing with 12 additions and 12 deletions.
  1. +4 −4 R/scale-gradient.r
  2. +4 −4 R/scale-gradient2.r
  3. +4 −4 R/scale-gradientn.r
View
8 R/scale-gradient.r
@@ -55,16 +55,16 @@
#' qplot(mpg, wt, data = mtcars, colour = miss) +
#' scale_colour_gradient(na.value = "black")
#' }
-scale_colour_gradient <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab", na.value = "grey50") {
+scale_colour_gradient <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab", na.value = "grey50", guide = "colorbar") {
continuous_scale("colour", "gradient", seq_gradient_pal(low, high, space),
- na.value = na.value, ...)
+ na.value = na.value, guide = guide, ...)
}
#' @rdname scale_gradient
#' @export
-scale_fill_gradient <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab", na.value = "grey50") {
+scale_fill_gradient <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab", na.value = "grey50", guide = "colorbar") {
continuous_scale("fill", "gradient", seq_gradient_pal(low, high, space),
- na.value = na.value, ...)
+ na.value = na.value, guide = guide, ...)
}
icon.gradient <- function(.) {
View
8 R/scale-gradient2.r
@@ -48,17 +48,17 @@
#' # Note how positive and negative values of the same magnitude
#' # have similar intensity
#' }
-scale_colour_gradient2 <- function(..., low = muted("red"), mid = "white", high = muted("blue"), midpoint = 0, space = "rgb", na.value = "grey50") {
+scale_colour_gradient2 <- function(..., low = muted("red"), mid = "white", high = muted("blue"), midpoint = 0, space = "rgb", na.value = "grey50", guide = "colorbar") {
continuous_scale("colour", "gradient2",
- div_gradient_pal(low, mid, high, space), na.value = na.value, ...,
+ div_gradient_pal(low, mid, high, space), na.value = na.value, guide = guide, ...,
rescaler = mid_rescaler(mid = midpoint))
}
#' @rdname scale_gradient2
#' @export
-scale_fill_gradient2 <- function(..., low = muted("red"), mid = "white", high = muted("blue"), midpoint = 0, space = "rgb", na.value = "grey50") {
+scale_fill_gradient2 <- function(..., low = muted("red"), mid = "white", high = muted("blue"), midpoint = 0, space = "rgb", na.value = "grey50", guide = "colorbar") {
continuous_scale("fill", "gradient2",
- div_gradient_pal(low, mid, high, space), na.value = na.value, ...,
+ div_gradient_pal(low, mid, high, space), na.value = na.value, guide = guide, ...,
rescaler = mid_rescaler(mid = midpoint))
}
View
8 R/scale-gradientn.r
@@ -31,15 +31,15 @@
#' d + scale_colour_gradientn(colours = terrain.colors(10),
#' values = values, rescaler = function(x, ...) x, oob = identity)
#' }
-scale_colour_gradientn <- function(..., colours, values = NULL, space = "Lab", na.value = "grey50") {
+scale_colour_gradientn <- function(..., colours, values = NULL, space = "Lab", na.value = "grey50", guide = "colorbar") {
continuous_scale("colour", "gradientn",
- gradient_n_pal(colours, values, space), na.value = na.value, ...)
+ gradient_n_pal(colours, values, space), na.value = na.value, guide = guide, ...)
}
#' @rdname scale_gradientn
#' @export
-scale_fill_gradientn <- function(..., colours, values = NULL, space = "Lab", na.value = "grey50") {
+scale_fill_gradientn <- function(..., colours, values = NULL, space = "Lab", na.value = "grey50", guide = "colorbar") {
continuous_scale("fill", "gradientn",
- gradient_n_pal(colours, values, space), na.value = na.value, ...)
+ gradient_n_pal(colours, values, space), na.value = na.value, guide = guide, ...)
}
icon.gradientn <- function(.) {
Please sign in to comment.
Something went wrong with that request. Please try again.