0

Hi I am using R gplots to create a heatmap for my project. So far I have written this code and created a heatmap successfully:

 library(gplots) 
    data<-read.csv("MATRIX_GAIN.txt",sep=','); 
    row.names(data) <- data$PARAMETERS
    data <- data[,2:18] 
    data_matrix<-data.matrix(data)     
    data_heatmap<-heatmap.2(t(data_matrix),
    col=redblue(256),dendrogram="none",density.info="none",scale="row",key=T,
    keysize=1.0,trace="none",cexRow=0.5, cexCol=0.6,symbreaks=T,margins=c(10, 8));

But now I want to add another column of data to the existing heatmap, that has a separate color scheme. Please comment.

PARAMETERS  List_H  List_O  List_A  List_F  List_G  List_N  List_I
A   1.2973  1.5639  0.7184  0.533   0.6628  1.2973  1.5639
B   0.1307  0.1575  0.1301  0.3805  0.6862  0.1307  0.1575
C   0.5706  0.6878  0.6306  0.3054  0.1207  0.5706  0.6878
D   1.0153  1.2239  1.0166  0.9835  0.5128  1.0153  1.2239
E   1.6615  0.7051  0.2836  -0.1766 0.706   1.6615  0.6511
F   0   0   0   0.209   0.5348  0   0
G   0.5448  0.6568  0.8642  0.6374  -0.0512 0.5448  0.6568
H   0.0658  0.0793  0.1245  0.3191  0.611   0.0658  0.0793
MrFlick
  • 195,160
  • 17
  • 277
  • 295
Process1
  • 478
  • 1
  • 3
  • 12
  • See the edit that @Csislander did; it's much easier to read with the code formatted. Check out the toolbar in the post edited for future posts. – Andrew Barber May 08 '14 at 18:57
  • Since you didn't include data, it's hard to see the output that you're seeing. Please following the recommendations in [this post](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to create a reproducible example. – MrFlick May 08 '14 at 18:59
  • I added a part of my data. I am not sure how to edit it. Please comment. – Process1 May 08 '14 at 19:06
  • Thanks Mr Flick Please tell me what did you do to make the data look like this. – Process1 May 08 '14 at 19:08
  • You just have to indent the lines by 4 spaces. If you highlight the section, and press ctrl-k it will indent it for you. So where do you want to add this column? And where is the data for this column coming from? – MrFlick May 08 '14 at 19:09
  • So I am gonna add another column showing sum of an individual parameter across all the lists. Then that column will have a separate color scheme and I can call it "SUM". I know how to add a column to a matrix but what I don't know is if I can add a separate color scheme for that column only and a legend for that as well. – Process1 May 08 '14 at 19:13
  • I found something relative.http://stackoverflow.com/questions/13016022/ggplot2-heatmaps-using-different-gradients-for-categories. Thanks – Process1 May 09 '14 at 01:06
  • @mparida Thank you for taking the time to post sample code. I was interested in finding a solution so i'm glad you found something that would work for you. If you have time, please post the solution you used as an answer to this question and accept it to close this thread. – MrFlick May 09 '14 at 17:43
  • Sure I used http://stackoverflow.com/questions/20778948/how-to-add-an-additional-single-column-heatmap-at-the-side-of-main-heatmap-in-r as my reference to build my solution. – Process1 May 16 '14 at 21:45
  • Solution to my question was built on reference to http://stackoverflow.com/questions/20778948/how-to-add-an-additional-single-column-heatmap-at-the-side-of-main-heatmap-in-r – Process1 May 16 '14 at 21:57

0 Answers0