Personally, I find it easier to fix the overall size of the "page" and
modify the margins in line size (mar and oma rather than mai and omi),
until I get the plots the way I want them. You don't specify what OS
you're using, but in windows, I would use something like
windows(h=16, w=9)
par(mfrow=c(4, 2), oma=c(2, 2, 2, 2), mar=c(2, 2, 2, 2))
I'm not sure why you're writing
mtext("testen")
for each plot when you already specify
main="test"
in the hist() function.
Did you want an overall title on the page?
If so, you could try ...
hist(islands, freq=FALSE,col="blue",main="test 1")
hist(islands, freq=FALSE,col="blue",main="test 2")
hist(islands, freq=FALSE,col="blue",main="test 3")
hist(islands, freq=FALSE,col="blue",main="test 4")
hist(islands, freq=FALSE,col="blue",main="test 5")
hist(islands, freq=FALSE,col="blue",main="test 6")
hist(islands, freq=FALSE,col="blue",main="test 7")
hist(islands, freq=FALSE,col="blue",main="test 8")
mtext("testen", outer=TRUE)
Hope this helps.
Jean
Nerak wrote on 03/13/2012 04:24:42 AM:
> Hi all,
> I have a basic question concerning graphs in R. I?m using the par()
> function and I?m working with multiple figures by row (mfrow) but my the
> hight of my figures become compressed. I have 4 rows and 2 columns
(because> I want to plot 8 histograms (freq = FALSE ) on it. I know I can adapt my
> margins with for example ?oma? and ?mai? but I don?t know how to choose
the> size of the figure? I read something about pin. That this should go
about> ?the current plot dimensions, (width, height), in inches. But I don?t
know> which values I should use. Because I always get the remark ?plot region
too> large?.
>
> I would like to have for example figures of 5,8 by 5,8 cm (is 2,3 by 2,3
> inches I think). But I don?t know how to specify this?. I'm getting
lost
> with the par() function
>
> Hard to give my data online for a reproducible example but with for
example> this, I have the same problems:
>
> par(mfrow=c(4,2),oma=c(2,2,2,2), mai=c(0.6, 0.6, 0.6, 0.6))
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
> hist(islands, freq=FALSE,col="blue",main="test")
> mtext("testen")
>
> (normally, I specify my breaks, ylab and xlab, xlim and y lim)
>
> I hope someone can help me.
> Many thanks,
> Nerak
[[alternative HTML version deleted]]