ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

Customized colorbar scale #24

Open dasiav7 opened 6 years ago

dasiav7 commented 6 years ago

Is it possible to set the colorscale that most value are white which means that not just the midpoint is white?

AliciaSchep commented 6 years ago

Not sure I understand -- can you please provide a more concrete example?

dasiav7 commented 6 years ago

Hi, Please see the image below. Thank you!

customised colorbar

AliciaSchep commented 6 years ago

Thanks for clarification. Unfortunately this is not easy with package as of now. A hacky work-around is to pass a vector of colors with several instances of "white", e.g:

mat <- matrix(rnorm(36),nrow = 6)
iheatmap(mat, colors = c("darkred","red","white","white","white","green","darkgreen")) 

Adjusting the number of colors specified, the fraction that are white, could give you the effect you're looking for.