reverse color scale
alpreyes opened this issue · 2 comments
alpreyes commented
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 commented
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:
- Add more to docs to explain this possibility
- Possibly add something like a
reverse_colorscale
option in future
alpreyes commented
Thank you, Alicia. This is greatly appreciated!