How to change heatmap.2 color range in R?

前端 未结 4 947
小蘑菇
小蘑菇 2020-12-23 12:21

I\'m using gplot to produce a heatmap showing log2-fold changes of a treatment groups versus paired controls. With the following code:

 heatmap.2(as.matrix(S         


        
4条回答
  •  甜味超标
    2020-12-23 13:10

    You could try to create your own color palette using the RColorBrewer package

    my_palette <- colorRampPalette(c("green", "black", "red"))(n = 1000)
    

    and see how this looks like. But I assume in your case only scaling would help if you really want to keep the black in "the middle". You can simply use my_palette instead of the redgreen()

    I recommend that you check out the RColorBrewer package, they have pretty nice in-built palettes, and see interactive website for colorbrewer.

提交回复
热议问题