I am trying to show the colors for each row in my matrix (min to max gradient):
[1,] 8 12 11 5 24
[2,] 1 2 7 0 8
[3,] 53 99 1501 15 9859
[4,] 59 24 19 19 32
[5,] 4 2 11 0 68
[6,] 4 9 177 2 710
[7,] 2 1 2 2 3
[8,] 0 5 133 0 2195
[9,] 3 3 2 1 15
[10,] 0 1 0 0 14
[11,] 0 3 21 0 17
[12,] 2 1 2 0 6
[13,] 11 26 22 3 16
[14,] 6 38 217 1 354
[15,] 3 10 17 0 68
[16,] 3 3 12 2 19
[17,] 7 5 26 1 40
[18,] 1 0 6 0 27
[19,] 1 0 37 0 434
[20,] 30 15 20 9 27
My code is as follows:
RT<-read.table("tmp",header=FALSE,sep="\t");
mat <-data.frame(RT)
pheatmap(mat, scale = "row",cluster_cols=FALSE,cluster_rows = FALSE, row.names =FALSE);
dev.off()
I have received the following image:
As you can see in the 2nd row the max needs to be red but it is orange because column 3 and 5 of the 2nd row have similar values. I want to do max is red, min is blue, and gradient between red,yellow and blue, for the values between max and min for each row independently. 0's always be blue. Only identical values should get the same color. I have tried other solutions from R: Row scaling not working correctly for heatmap but that didn't work for me. Please help.