Skip to content

Allow to reverse the order of colours in a brewer palette#812

Closed
jiho wants to merge 1 commit intotidyverse:masterfrom
jiho:feature/reverse_brewer
Closed

Allow to reverse the order of colours in a brewer palette#812
jiho wants to merge 1 commit intotidyverse:masterfrom
jiho:feature/reverse_brewer

Conversation

@jiho
Copy link
Contributor

@jiho jiho commented May 16, 2013

Use the same argument that scale_*_hue uses: direction

Use the same argument that scale_*_hue uses: direction
@jiho
Copy link
Contributor Author

jiho commented May 16, 2013

Requires a change in scales, in pull request 36 r-lib/scales#36

@jiho
Copy link
Contributor Author

jiho commented May 16, 2013

Even if color brewer scales are meant to be discrete, sometimes they can be used to denote ordered factors (such as abundance classes, etc.). In that case, many brewer palettes go in the "wrong" direction, associating warm colours with small values. For example:

library(ggplot2)
set.seed(123)
d <- data.frame(x=runif(100), y=runif(100), z=factor(round(runif(10)*5)))
p <- ggplot(d) + geom_point(aes(x, y, colour=z))
p + scale_color_brewer(palette="Spectral")

image

Now compare with

p + scale_color_brewer(palette="Spectral", direction=-1)

image

@hadley
Copy link
Member

hadley commented Feb 24, 2014

Could you please rebase/merge against master, re-document with the development version of roxygen2 (install_github("klutometis/roxygen) and resubmit?

@hadley hadley closed this Feb 24, 2014
@lock
Copy link

lock bot commented Jan 19, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants