Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse color scale #20

Open
alpreyes opened this issue Jan 26, 2018 · 2 comments
Open

reverse color scale #20

alpreyes opened this issue Jan 26, 2018 · 2 comments
Labels

Comments

@alpreyes
Copy link

Is it possible to reverse the color scale in one-color gradients so that the darker color correspond to the to lower values and lighter colors correspond to greater values?

@AliciaSchep
Copy link
Contributor

AliciaSchep commented Jan 29, 2018

This is possible, albeit a bit clunky at the moment. The colors argument to functions like main_heatmap and iheatmap can take in a vector of colors instead of a palette name. So you can do something like:

mat <- matrix(rnorm(20), ncol = 5, nrow = 4)  
main_heatmap(mat, colors = rev(RColorBrewer::brewer.pal(3,"Reds"))) 
# Can change 3 to higher number 
# rev function reverses order of the colors
# colors argument also works for iheatmap function

I'll keep this issue open as a note to either:

  1. Add more to docs to explain this possibility
  2. Possibly add something like a reverse_colorscale option in future

@alpreyes
Copy link
Author

Thank you, Alicia. This is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants