From 6a113f694e3f9bfa2187a1de593a114c5d43feb6 Mon Sep 17 00:00:00 2001 From: Arthur Yip <5713411+ahcyip@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:34:21 -0600 Subject: [PATCH 1/3] Update scale-brewer.R Capturing in documentation that scale_*_distiller has a non-intuitive default direction = -1, and that to reverse, user needs to specify direction = 1 Source: https://github.com/tidyverse/ggplot2/issues/1439 https://github.com/tidyverse/ggplot2/issues/4444 --- R/scale-brewer.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/scale-brewer.R b/R/scale-brewer.R index 72264f98f4..d9b8e07ff2 100644 --- a/R/scale-brewer.R +++ b/R/scale-brewer.R @@ -15,6 +15,7 @@ #' The `brewer` scales were carefully designed and tested on discrete data. #' They were not designed to be extended to continuous data, but results often #' look good. Your mileage may vary. +#' The `distiller` scales have a default direction = -1. To reverse, use direction = 1. #' #' @section Palettes: #' The following palettes are available for use with these scales: @@ -75,6 +76,8 @@ #' v #' v + scale_fill_distiller() #' v + scale_fill_distiller(palette = "Spectral") +#' # the order of colour can be reversed, but with scale_*_distiller(), the default direction = -1, so to reverse, use direction = 1. +#' v + scale_fill_distiller(palette = "Spectral", direction = 1) #' #' # or use blender variants to discretise continuous data #' v + scale_fill_fermenter() From 36abbafd89c2ca3ed5ecd0c9cfcd6c6acf281c32 Mon Sep 17 00:00:00 2001 From: Arthur Yip <5713411+ahcyip@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:38:45 -0600 Subject: [PATCH 2/3] Move comment from Details to Note --- R/scale-brewer.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/scale-brewer.R b/R/scale-brewer.R index d9b8e07ff2..2bf583961a 100644 --- a/R/scale-brewer.R +++ b/R/scale-brewer.R @@ -8,14 +8,14 @@ #' #' @note #' The `distiller` scales extend `brewer` scales by smoothly -#' interpolating 7 colours from any palette to a continuous scale. The `fermenter` -#' scales provide binned versions of the `brewer` scales. +#' interpolating 7 colours from any palette to a continuous scale. +#' The `distiller` scales have a default direction = -1. To reverse, use direction = 1. +#' The `fermenter` scales provide binned versions of the `brewer` scales. #' #' @details #' The `brewer` scales were carefully designed and tested on discrete data. #' They were not designed to be extended to continuous data, but results often #' look good. Your mileage may vary. -#' The `distiller` scales have a default direction = -1. To reverse, use direction = 1. #' #' @section Palettes: #' The following palettes are available for use with these scales: From ed414135b51993326c96ecac92aeb5e7bfb119e0 Mon Sep 17 00:00:00 2001 From: yutannihilation Date: Sun, 3 Sep 2023 03:17:18 +0000 Subject: [PATCH 3/3] Document --- man/scale_brewer.Rd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/man/scale_brewer.Rd b/man/scale_brewer.Rd index c71599ca40..073d3f0d02 100644 --- a/man/scale_brewer.Rd +++ b/man/scale_brewer.Rd @@ -119,8 +119,9 @@ look good. Your mileage may vary. } \note{ The \code{distiller} scales extend \code{brewer} scales by smoothly -interpolating 7 colours from any palette to a continuous scale. The \code{fermenter} -scales provide binned versions of the \code{brewer} scales. +interpolating 7 colours from any palette to a continuous scale. +The \code{distiller} scales have a default direction = -1. To reverse, use direction = 1. +The \code{fermenter} scales provide binned versions of the \code{brewer} scales. } \section{Palettes}{ @@ -168,6 +169,8 @@ v <- ggplot(faithfuld) + v v + scale_fill_distiller() v + scale_fill_distiller(palette = "Spectral") +# the order of colour can be reversed, but with scale_*_distiller(), the default direction = -1, so to reverse, use direction = 1. +v + scale_fill_distiller(palette = "Spectral", direction = 1) # or use blender variants to discretise continuous data v + scale_fill_fermenter()