[BioC] multiple pairs plot in a single window

Natasha Sahgal nsahgal at well.ox.ac.uk
Tue Mar 19 11:12:35 CET 2013


Hi Jim,

Sorry, didn't realise. 

The pairs function from the graphics package. So if I do something like: 

png("Data4.png")
pairs(d, upper.panel=panel.cor, labels=group, main="Data 4")
dev.off()

it works, and I generate 4 separate scatterplots for each dataset.

However I want all 4 plots in a single figure/file, rather than having 4 separate files. (I.e. 1 row with 4 columns, or 2 rows with 2 columns each).

Thus, I then tried,

png("AllData.png")
par(mfrow=c(1,4))
pairs(a, upper.panel=panel.cor, labels=group, main="Data 1")
pairs(b,upper.panel=panel.cor,labels=group,main="Data 2")
pairs(c, upper.panel=panel.cor,labels=group,main="Data 3")
pairs(d, upper.panel=panel.cor, labels=group, main="Data 4")
dev.off()

But this did not give me a single plot window with all 4 plots, rather just the last plot for Data 4. Then I found the split.screen function (graphics package), the code in my previous email, but that too gave just the final plot for data 4 (and this did look weird!)


My Data is basically 4 datasets (e.g. array &/or RNA-Seq) each with 4 samples. 


Hope that makes sense.

Many Thanks,
Natasha


sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] scatterplot3d_0.3-33 Hmisc_3.10-1         survival_2.36-14    
[4] DESeq_1.10.1         lattice_0.20-10      locfit_1.5-8        
[7] Biobase_2.18.0       BiocGenerics_0.4.0  

loaded via a namespace (and not attached):
 [1] annotate_1.36.0      AnnotationDbi_1.20.2 cluster_1.14.3      
 [4] DBI_0.2-5            genefilter_1.40.0    geneplotter_1.36.0  
 [7] grid_2.15.2          IRanges_1.16.4       parallel_2.15.2     
[10] RColorBrewer_1.0-5   RSQLite_0.11.2       stats4_2.15.2       
[13] tools_2.15.2         XML_3.95-0.1         xtable_1.7-0


-----Original Message-----
From: James W. MacDonald [mailto:jmacdon at uw.edu] 
Sent: 18 March 2013 20:44
To: Natasha Sahgal
Cc: Bioconductor mailing list
Subject: Re: [BioC] multiple pairs plot in a single window

Hi Natasha,

The pairs() function from what package? By 'didn't work' what exactly do you mean? You are not giving us much to go on here.

Best,

Jim


On 3/18/13 7:59 AM, Natasha Sahgal wrote:
> Dear List,
>
> I have 4 datasets and am interested in generating a pairs plot for each.
> However, I'm interested in all the 4 pairs plots to be in a single window.
>
> I tried mfrow but that didn't work, then I tried split.screen (code below) but that doesn't work either.
>
> # Window With 2 Rows, Top & Bottom Row In 2 Columns
> #jpeg("multScatter.jpg",height=1000,width=1000)
> split.screen(c(2,1)) # Makes Screen 1 and 2 split.screen(c(1,2), 
> screen=1) # Makes Screen 3 and 4 split.screen(c(1,2), screen=2) # 
> Makes Screen 5 and 6
>
> # Pairs plots on Screens 3, 4, 5 & 6
> screen(3)
> pairs(a, upper.panel=panel.cor, labels=group, main="Data 1")
> screen(4)
> pairs(b,upper.panel=panel.cor,labels=group,main="Data 2")
> screen(5)
> pairs(c, upper.panel=panel.cor,labels=group,main="Data 3")
> screen(6)
> pairs(d, upper.panel=panel.cor, labels=group, main="Data 4")
> #dev.off()
>
> ###############
>
> # Window With 1 Rows and 4 columns
> #jpeg("multScatter.jpg",height=1000,width=1000)
> split.screen(c(1,4)) # Makes Screen 1 to 4
> screen(1)
> pairs(a, upper.panel=panel.cor, labels=group, main="Data 1")
> screen(2)
> pairs(b,upper.panel=panel.cor,labels=group,main="Data 2")
> screen(3)
> pairs(c, upper.panel=panel.cor,labels=group,main="Data 3")
> screen(4)
> pairs(d, upper.panel=panel.cor, labels=group, main="Data 4")
> #dev.off()
>
> Any help or alternatives would be highly appreacited!
>
>
> ManyThanks,
> Natasha
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: 
> http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list