[OGRUG] Putting two figures together in R
robtbiddle at gmail.com
Tue Jul 20 15:58:18 CEST 2010
I'm not 100% sure I know what you want, but if it's just to have
two plots in the same image side by side, I do this all the time using
par and mfrow.
A simple example would go like this:
That gives an image with a histogram on the left and a boxplot on the right.
You can vary the mfrow numbers as you wish to have them in a row, a
column, or a grid.
The c(1,1) setting at the end is just to change back to a single plot.
Anyway, when it looks right, then you can just save the window to a file.
For data and graphs I tinker with a lot, I normally embed this kind of
thing within a call to pdf or png to
both display the images and save them to a file.
Anyway, I hope this helps.
On 10-07-19 6:28 PM, Young Song wrote:
> I have two scripts that are used to generate heatmap and bar graph
> *A. Heatmap script:*
> 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)
> 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.
> Young C. Song
> Masters Student
> University of British Columbia Graduate Program in Bioinformatics
> Vancouver, BC V6T 1Z4, Canada
> R-UG-Ottawa mailing list
> R-UG-Ottawa at r-project.org
More information about the R-UG-Ottawa