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

specify that zero values get neutral color in diverging data #81

Open
kieran-mace opened this issue Oct 26, 2017 · 3 comments
Open

specify that zero values get neutral color in diverging data #81

kieran-mace opened this issue Oct 26, 2017 · 3 comments

Comments

@kieran-mace
Copy link

Depending on the distribution of the data, sometimes I get zero values as red, or blue. could there be an option that forces zero to white?

@kieran-mace
Copy link
Author

similar to balanceColor=TRUE in heatmap3

@talgalili
Copy link
Owner

Hi @KMace
The d3heatmap is currently not under active development. Another project that you might consider is the heatmaply package. For what you ask for, please look at the last example here:
https://cran.r-project.org/web/packages/heatmaply/vignettes/heatmaply.html#changing-color-palettes

heatmaply(mtcars, margins = c(40, 130), 
          scale_fill_gradient_fun = ggplot2::scale_fill_gradient2(low = "blue", high = "red", midpoint = 200, limits = c(0, 500)))

With this output (which will be interactive)

image

@klaukh
Copy link
Contributor

klaukh commented Dec 27, 2017

@KMace
Over on my fork - https://github.com/klaukh/d3heatmap - I've been slowly working many of the community requests, including the one you've mentioned and a more modern API. You can either do d3heatmap(..., symbreaks = TRUE) to match the heatmap.2 and heatmap.3 APIs, or do d3heatmap(...) %>% hmColors(..., symmetrical = TRUE) to achieve what you're looking for.

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

No branches or pull requests

3 participants