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

integration with viridis package #25

Open
alpreyes opened this issue Apr 25, 2018 · 1 comment
Open

integration with viridis package #25

alpreyes opened this issue Apr 25, 2018 · 1 comment
Labels

Comments

@alpreyes
Copy link

You instructed me in a previous answer how to change the default color scale of iheatmapr using RColorBrewer palettes. Is there a way to to use the color palettes in the R package "virids" (https://github.com/sjmgarnier/viridis)?

@AliciaSchep
Copy link
Contributor

Hi @alpreyes There is no automatic integration with viridis package, but you can use those palettes as follows:

mat <- matrix(rnorm(20), ncol = 5, nrow = 4)
main_heatmap(mat, colors = viridis::viridis(12))

The colors argument can take a vector of colors. That vector can be generated using functions from viridis package. I chose n = 12 as number of colors above, but it gives pretty similar results with various n values of 5+ (there may be a right answer as to the number of colors based on how the viridis scales are constructed, but don't know at the moment).

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