R: save grid and base objects on same plot when making forest plots
0
0
Entering edit mode
3.4 years ago
mgene • 0

I would like to plot grid objects and base R objects on the same png. The package I am using the meta package to make forest plots uses the grid graphics system.

I would like to use mfrow for this if possible, as it is what I am using elsewhere.

If I plot:

png("test.png",width=297,height=210,units="mm",res=300)
par(mfrow=c(2,2))
plot(1,1)
plot(1,1)
plot(1,1)
plot(1,1)
dev.off()

Everything works fine.

However if I plot:

library(meta)
m <- metaprop(4:1, c(10, 20, 30, 40))
png("test.png",width=297,height=210,units="mm",res=300)
par(mfrow=c(2,2))
plot(1,1)
forest(m,new=F)
plot(1,1)
forest(m,new=F)
dev.off()

Things aren't right as the forest plots try to take up the whole page rather than being restricted to their corners.

Thanks in advance for your help

R meta forest grid base r • 738 views
ADD COMMENT
0
Entering edit mode

I know this is a really late response, but you may want to check on StackOverlow as this is a CS intensive topic. Maybe a look at viewports might provide a lead.

ADD REPLY

Login before adding your answer.

Traffic: 2510 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6