[OGRUG] Putting two figures together in R

Young Song youngcsong at gmail.com
Tue Jul 20 00:28:56 CEST 2010


Hello,

   I have two scripts that are used to generate heatmap and bar graph

*A. Heatmap script:*

library(RColorBrewer)
library(gplots)

par(mfrow=c(2,1))

Totaltax<-read.table("heatmap_data.txt",header=TRUE)
Totaltax_log<-log(Totaltax+1)
Totaltax_mat<-data.matrix(Totaltax_log)
Totaltax_column<-t(Totaltax_mat)
cdendro<-as.dendrogram(hclust(dist(Totaltax_column,
method="manhattan")),method="complete")
heatmap.2(Totaltax_mat, Colv=cdendro, distfun=dist, key=TRUE, keysize=1,
trace="none", margins=c(5,13), col=brewer.pal(9,"BuPu"))


*B. Bar graph script:*

histo <- read.table("histo_data.txt", header=T)

barplot(histo$Value)


Usually, I would run each script separately, and put the two resulting
diagrams together using Adobe Illustrator.  I was wondering if there is a
way to put these two diagrams together in R, instead of going through the
manual procedures.  I am currently using R version 2.11.1 on Mac OS X 10.6.
The actual data used to generate the diagrams are attached in this message.
Thank you very much in advance.

 Sincerely,

   Young
-- 
Young C. Song
Masters Student
University of British Columbia Graduate Program in Bioinformatics
Vancouver, BC V6T 1Z4, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-ug-ottawa/attachments/20100719/0f8150f9/attachment.html>
-------------- next part --------------
	SP_1.8m	SP_2.2m	SP_2.9m	SP_3.1m	SP_3.4m	SP_3.7m
GSB_01	22	65	3181	3627	4165	3786
GSB_02	2	13	812	1040	1107	991
GSB_03	0	5	347	399	392	353
GSB_04	0	1	64	73	87	92
GSB_05	0	2	48	91	60	69
GSB_06	0	0	39	52	64	63
GSB_07	2	2	39	49	61	63
GSB_08	0	0	31	50	69	55
GSB_09	1	0	20	34	37	85
GSB_10	0	1	41	46	49	34
GSB_11	0	1	26	39	31	28
GSB_12	1	0	17	27	25	27
GSB_13	0	0	16	29	24	27
-------------- next part --------------
Index	Value
1	14846
2	3965
3	1496
4	317
5	270
6	218
7	216
8	205
9	177
10	171
11	125
12	97
13	96
14	47
15	42
16	33
17	30
18	29
19	28
20	28
21	25
22	22
23	22
24	21
25	18
26	17
27	17
28	17
29	16
30	16
31	15
32	15
33	14
34	13
35	13
36	13
37	13
38	12
39	12
40	12
41	11
42	11
43	10
44	10
45	10
46	10
47	8
48	8
49	8
50	8
51	8
52	8
53	7
54	7
55	7
56	7
57	7
58	7
59	6
60	6
61	6
62	6
63	6
64	6
65	6
66	6
67	5
68	5
69	5
70	5
71	5
72	5
73	5
74	5
75	5


More information about the R-UG-Ottawa mailing list