[R] Matrix heatmap

fjucks aldomichelato at gmail.com
Wed May 9 20:40:03 CEST 2012


http://r.789695.n4.nabble.com/file/n4621356/Captura_de_tela-13.png 

The heat map generated the correct result:

library(gplots)
arq <-read.table("l")
matrix_l <-data.matrix(arq)
my.colors <-
colorRampPalette(c("gray0","gray10","gray20","gray30","gray40","gray50","gray60","gray80","gray90","gray100"))
heatmap.2(matrix_l,dendrogram="none", Rowv=NA, Colv=NA, col=my.colors(256)) 

--------------------------

Now I have the following file with 5 data, similar to the above:

	RF00002	RF00013	RF00100	RF00381	RF00434	RF00453	RF00165	RF00496	RF00497
RF00014	RF00048	RF00234	RF00163	RF00008	RF00094	RF00032	RF00028	RF00216
RF00487	RF00209	RF00465	RF00485	RF00363	RF00366
RF00002	63	7	5	7	17	12	14	5	23	3	56	14	72	84	15	64	20	0	1	8	6	65	3	4
RF00013	45	7	4	6	17	12	14	5	23	3	56	12	60	84	15	64	20	0	0	2	2	65	3	4
RF00100	22	1	5	3	2	9	0	0	0	0	5	0	16	8	1	0	0	0	0	0	0	26	2	3
RF00381	63	7	5	13	17	11	3	5	18	3	56	14	33	12	2	15	4	18	12	25	11	69	3	4
RF00434	2	0	0	3	17	11	14	5	23	3	55	12	59	84	15	64	20	0	0	0	0	40	1	3
RF00453	3	1	0	2	16	12	13	3	7	0	45	12	42	78	15	53	20	0	0	0	0	33	2	0
RF00165	0	0	0	2	10	1	14	1	7	0	44	12	38	68	13	48	20	0	0	0	0	18	0	0
RF00496	0	0	0	0	0	0	1	5	6	0	0	0	4	2	0	0	0	0	0	0	0	0	0	0
RF00497	0	0	0	3	10	0	12	5	23	3	40	8	37	77	15	64	20	0	0	0	0	20	0	0
RF00014	0	0	0	0	0	0	0	0	8	3	6	0	0	0	0	0	0	0	0	0	0	0	0	0
RF00048	3	1	0	3	17	10	14	5	23	3	56	12	59	83	15	64	20	0	0	0	0	52	3	3
RF00234	62	7	5	6	17	12	14	5	23	3	56	14	70	84	15	64	20	0	0	0	1	65	3	4
RF00163	63	7	5	7	17	12	14	5	23	3	56	14	75	84	15	64	21	6	1	10	9	65	3	4
RF00008	3	1	0	3	17	12	14	5	23	3	56	12	58	84	15	64	20	0	0	0	0	52	3	2
RF00094	0	0	0	0	0	1	11	0	1	0	0	0	34	73	15	49	20	0	0	0	0	12	0	0
RF00032	0	0	0	3	10	1	14	5	23	3	56	12	43	80	15	64	20	0	0	0	0	21	0	0
RF00028	63	7	5	13	17	12	14	5	23	3	56	14	75	84	15	64	30	23	14	25	20	85	3	4
RF00216	63	7	5	13	17	12	14	5	23	3	56	14	75	84	15	64	28	23	14	25	20	85	3	4
RF00487	63	7	5	13	17	12	14	5	23	3	56	14	75	84	15	64	28	20	14	25	16	83	3	4
RF00209	50	7	5	3	2	2	0	0	0	0	1	2	26	4	0	0	1	0	8	25	5	28	3	3
RF00465	59	7	5	10	7	11	0	0	10	3	11	2	32	9	1	3	6	15	5	14	20	63	3	4
RF00485	63	7	5	13	17	12	14	5	23	3	56	14	75	84	15	64	26	17	14	25	19	85	3	4
RF00363	5	3	0	3	10	1	1	5	20	3	50	12	44	24	5	5	0	0	0	0	0	42	3	3
RF00366	8	2	1	4	14	9	13	5	23	3	52	12	51	68	12	8	0	0	0	0	0	48	3	4

Now I have the following file with 5 data, similar to the above:
Is represented by an array of 25x25 and 10x10 not like the previous

when I give the command dput (arch) it returns me the following output:

structure(list(RF00002 = c(63L, 45L, 22L, 63L, 2L, 3L, 0L, 0L, 
0L, 0L, 3L, 62L, 63L, 3L, 0L, 0L, 63L, 63L, 63L, 50L, 59L, 63L, 
5L, 8L), RF00013 = c(7L, 7L, 1L, 7L, 0L, 1L, 0L, 0L, 0L, 0L, 
1L, 7L, 7L, 1L, 0L, 0L, 7L, 7L, 7L, 7L, 7L, 7L, 3L, 2L), RF00100 = c(5L, 
4L, 5L, 5L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 5L, 5L, 0L, 0L, 0L, 5L, 
5L, 5L, 5L, 5L, 5L, 0L, 1L), RF00381 = c(7L, 6L, 3L, 13L, 3L, 
2L, 2L, 0L, 3L, 0L, 3L, 6L, 7L, 3L, 0L, 3L, 13L, 13L, 13L, 3L, 
10L, 13L, 3L, 4L), RF00434 = c(17L, 17L, 2L, 17L, 17L, 16L, 10L, 
0L, 10L, 0L, 17L, 17L, 17L, 17L, 0L, 10L, 17L, 17L, 17L, 2L, 
7L, 17L, 10L, 14L), RF00453 = c(12L, 12L, 9L, 11L, 11L, 12L, 
1L, 0L, 0L, 0L, 10L, 12L, 12L, 12L, 1L, 1L, 12L, 12L, 12L, 2L, 
11L, 12L, 1L, 9L), RF00165 = c(14L, 14L, 0L, 3L, 14L, 13L, 14L, 
1L, 12L, 0L, 14L, 14L, 14L, 14L, 11L, 14L, 14L, 14L, 14L, 0L, 
0L, 14L, 1L, 13L), RF00496 = c(5L, 5L, 0L, 5L, 5L, 3L, 1L, 5L, 
5L, 0L, 5L, 5L, 5L, 5L, 0L, 5L, 5L, 5L, 5L, 0L, 0L, 5L, 5L, 5L
), RF00497 = c(23L, 23L, 0L, 18L, 23L, 7L, 7L, 6L, 23L, 8L, 23L, 
23L, 23L, 23L, 1L, 23L, 23L, 23L, 23L, 0L, 10L, 23L, 20L, 23L
), RF00014 = c(3L, 3L, 0L, 3L, 3L, 0L, 0L, 0L, 3L, 3L, 3L, 3L, 
3L, 3L, 0L, 3L, 3L, 3L, 3L, 0L, 3L, 3L, 3L, 3L), RF00048 = c(56L, 
56L, 5L, 56L, 55L, 45L, 44L, 0L, 40L, 6L, 56L, 56L, 56L, 56L, 
0L, 56L, 56L, 56L, 56L, 1L, 11L, 56L, 50L, 52L), RF00234 = c(14L, 
12L, 0L, 14L, 12L, 12L, 12L, 0L, 8L, 0L, 12L, 14L, 14L, 12L, 
0L, 12L, 14L, 14L, 14L, 2L, 2L, 14L, 12L, 12L), RF00163 = c(72L, 
60L, 16L, 33L, 59L, 42L, 38L, 4L, 37L, 0L, 59L, 70L, 75L, 58L, 
34L, 43L, 75L, 75L, 75L, 26L, 32L, 75L, 44L, 51L), RF00008 = c(84L, 
84L, 8L, 12L, 84L, 78L, 68L, 2L, 77L, 0L, 83L, 84L, 84L, 84L, 
73L, 80L, 84L, 84L, 84L, 4L, 9L, 84L, 24L, 68L), RF00094 = c(15L, 
15L, 1L, 2L, 15L, 15L, 13L, 0L, 15L, 0L, 15L, 15L, 15L, 15L, 
15L, 15L, 15L, 15L, 15L, 0L, 1L, 15L, 5L, 12L), RF00032 = c(64L, 
64L, 0L, 15L, 64L, 53L, 48L, 0L, 64L, 0L, 64L, 64L, 64L, 64L, 
49L, 64L, 64L, 64L, 64L, 0L, 3L, 64L, 5L, 8L), RF00028 = c(20L, 
20L, 0L, 4L, 20L, 20L, 20L, 0L, 20L, 0L, 20L, 20L, 21L, 20L, 
20L, 20L, 30L, 28L, 28L, 1L, 6L, 26L, 0L, 0L), RF00216 = c(0L, 
0L, 0L, 18L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 6L, 0L, 0L, 0L, 
23L, 23L, 20L, 0L, 15L, 17L, 0L, 0L), RF00487 = c(1L, 0L, 0L, 
12L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 14L, 14L, 
14L, 8L, 5L, 14L, 0L, 0L), RF00209 = c(8L, 2L, 0L, 25L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 10L, 0L, 0L, 0L, 25L, 25L, 25L, 25L, 
14L, 25L, 0L, 0L), RF00465 = c(6L, 2L, 0L, 11L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 1L, 9L, 0L, 0L, 0L, 20L, 20L, 16L, 5L, 20L, 19L, 
0L, 0L), RF00485 = c(65L, 65L, 26L, 69L, 40L, 33L, 18L, 0L, 20L, 
0L, 52L, 65L, 65L, 52L, 12L, 21L, 85L, 85L, 83L, 28L, 63L, 85L, 
42L, 48L), RF00363 = c(3L, 3L, 2L, 3L, 1L, 2L, 0L, 0L, 0L, 0L, 
3L, 3L, 3L, 3L, 0L, 0L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), RF00366 = c(4L, 
4L, 3L, 4L, 3L, 0L, 0L, 0L, 0L, 0L, 3L, 4L, 4L, 2L, 0L, 0L, 4L, 
4L, 4L, 3L, 4L, 4L, 3L, 4L)), .Names = c("RF00002", "RF00013", 
"RF00100", "RF00381", "RF00434", "RF00453", "RF00165", "RF00496", 
"RF00497", "RF00014", "RF00048", "RF00234", "RF00163", "RF00008", 
"RF00094", "RF00032", "RF00028", "RF00216", "RF00487", "RF00209", 
"RF00465", "RF00485", "RF00363", "RF00366"), class = "data.frame", row.names
= c("RF00002", 
"RF00013", "RF00100", "RF00381", "RF00434", "RF00453", "RF00165", 
"RF00496", "RF00497", "RF00014", "RF00048", "RF00234", "RF00163", 
"RF00008", "RF00094", "RF00032", "RF00028", "RF00216", "RF00487", 
"RF00209", "RF00465", "RF00485", "RF00363", "RF00366"))

but he is not in scale with the gray color I wanted, like he looks like
this:

http://r.789695.n4.nabble.com/file/n4621356/Captura_de_tela-14.png 

I  wanted to do, that it generates histogram, stayed the count from 0 to 25
(because I have 25 data) and the value of (0-100)









--
View this message in context: http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4621356.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list