r - Heatmap.2 color gradient with an additional solid color -


the heatmap using creates gradient 0.7 1.3 using heatmap.2:

heatmap.2(lifespan.matrix, col=bluered, breaks=c(seq(0.7,1.3,0.01)), rowv = false, colv = false, trace="none", main="lifespan") 

in heatmap can see gradient emerge ending oftenly in solid blue line. happens because of 0 values in matrix @ these points.

enter image description here

i'd change color, in matrix noted 0, different color i.e. yellow. me problem?

breaks <- seq(0.7,1.3,0.01) lifespan.matrix <- matrix(sample(c(breaks,rep(0,100)),100,replace=true),nrow=10) heatmap.2(lifespan.matrix, col=c("#ffff00",bluered(length(breaks)-2)), breaks=breaks, rowv = false, colv = false, trace="none", main="lifespan") 

you specify exact colors associated breaks.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -