[R] Layout of two graphs on a page...

Jim Lemon jim at bitwrit.com.au
Sun Jun 22 01:52:58 CEST 2014

On Sat, 21 Jun 2014 11:49:46 AM Kate Ignatius wrote:
> I'm trying to have a layout of two graphs on a page... this has 
> before... but I changed up the way I do my venn diagrams so now
> instead of the Venn Diagram being at the bottom of the page below 
> bar/line graph it takes up the whole page and its overlays the
> bar/line graph placed on the top half...
> Here is my code:
> oldmar <- par("mar")
> par(oma=c(0,2,0,2),mar=c(5.1,4.1,4.1,3.1))
> my_tcks<-pretty(c(0,max(counts)),6)
> b <- barplot(counts,col='purple',axes=F,border=FALSE,cex.names 
= 0.75,
> las=2, ylim=c(0,my_tcks[length(my_tcks)]))
> axis(2,at=my_tcks, labels=format(my_tcks, scientific = FALSE),
> cex.axis=0.75, las=2)
> mtext("",side=2,line=4,cex=1)
> par(new=TRUE)
> barplot(rep(NA,4),ylim=c(0,(max(ratio)+1)),axes=FALSE)
> axis(4, cex.axis=0.75, las=2)
> mtext("",side=4,line=2,cex=1)
> lines(b, ratio,col="black",lwd=2)
> par(mar=oldmar)
> par(new=FALSE)
> library(VennDiagram)
> 1234=n1234, 
> alpha=c(0.2,0.2,0.2,0.2), euler.d=FALSE, scaled=FALSE, cex=2, 
> main="")
> dev.off()
> I've changed around the oma and mar settings so much now that 
I'm a
> tad confused and probably over looking something really obvious.
Hi Kate,
My guess is that the layout() command and the grid graphics used by 
draw.quad.venn are conflicting. I have an idea that inserting a 
grid.frame into the function may restrict the Venn diagram to a portion 
of the graphics device, but I haven't got the time at the moment to 
work out how to do this and it is an awful hack anyway. 


More information about the R-help mailing list