Skip to content

pheatmap breaks

2 messages · Adrian Johnson, Jim Lemon

#
Hi group:
I tried multiple times cannot understand the breaks to work for my heatmap.

I am using following way:

pheatmap(chxx,

cluster_cols=FALSE,
annotation_col=annotcols,
annotation_colors=anno_colors,
col=colorRampPalette(c("dark blue", "white", "#ff0000"))(34),
show_colnames=F)
[1] 4.421862
[1] -3.324021


I want to plot anything above 1.96 as red,  anything below -1.96 as blue
1.195  as pink and 0 - 0.99 as gradient of white pink.

similarly, < -1.96 as blue,    values greater than -1.96 less that -1
gets light blue and 0 to -0.99 get white gradient to blue.


there will be 7 breaks

  < - 1.96--- - 1-  -.99---- 0 ------0.99-1---1.96---->1.96

how can I define the breaks.

appreciate your help. Thanks in advance.

Adrian
#
Hi Adrian,
I had to add an extra color, but this might do what you want:

chxx<-matrix(runif(100,-3.32,4.422),nrow=10)
chxx.cut<-as.numeric(cut(chxx,breaks=c(-3.5,-1.96,-1,0,1,1.96,5)))
chxx.col<-c("#0000FF","#8888FF","#AAAAFF","#FF8888","#FFAAAA",NA)[chxx.cut]
library(plotrix)
chxx_highcol<-color.scale(chxx[chxx>1.96],extremes=c("#FFAAAA","#FFFFFF"))
chxx.col<-matrix(chxx.col,nrow=10)
chxx.col[is.na(chxx.col)]<-chxx_highcol
color2D.matplot(chxx,cellcolors=chxx.col,show.values=TRUE)

Jim


On Sat, Aug 20, 2016 at 7:22 AM, Adrian Johnson
<oriolebaltimore at gmail.com> wrote: