Hi, I want to do something like this: par(mfrow=c(7,7)) for (i in 1:49) hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6), main="",xlab="",ylab="",xaxt="n",yaxt="n") (Don't think about what RATDACOM and SUBJNO are.) I get an error Error in plot.new() : Figure margins too large. 36 histograms with mfrow=c(6,6) work. But the 36 histograms are then so small that I wonder why 49 do not fit. It seems that though I have main="",xlab="",ylab="",xaxt="n",yaxt="n" the area reserved for axes and labels is almost as large as it would be if I would print a single histogram. The histogram itself only gets the remaining space, which is very small (I could draw 36*4 histograms of this size on a single page and the margins between them would still be OK). So the question is: How do I tell R to print the essential histogram area without main, labs and axes large enough that it looks well but small enough that 49 fit on one page? (If I would draw them by hand, no problem...) Best, Christian *********************************************************************** Christian Hennig Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/>From 1 April 2005: Department of Statistical Science, UCL, London####################################################################### ich empfehle www.boag-online.de
You may want to set par(mar, oma) to something small, or start the device (which one are you using?) with large enough dimension, or both. Andy> From: Christian Hennig > > Hi, > > I want to do something like this: > > par(mfrow=c(7,7)) > for (i in 1:49) > hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6), > main="",xlab="",ylab="",xaxt="n",yaxt="n") > > (Don't think about what RATDACOM and SUBJNO are.) > > I get an error > Error in plot.new() : Figure margins too large. > > 36 histograms with mfrow=c(6,6) work. > But the 36 histograms are then so small that I wonder why 49 > do not fit. > It seems that though I have > main="",xlab="",ylab="",xaxt="n",yaxt="n" the > area reserved for axes and labels is almost as large as it > would be if I > would print a single histogram. The histogram itself only > gets the remaining > space, which is very small (I could draw 36*4 histograms of > this size on a > single page and the margins between them would still be OK). > > So the question is: > How do I tell R to print the essential histogram area without > main, labs and > axes large enough that it looks well but small enough that 49 > fit on one > page? (If I would draw them by hand, no problem...) > > Best, > Christian > > > ************************************************************** > ********* > Christian Hennig > Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg > hennig at math.uni-hamburg.de, > http://www.math.uni-hamburg.de/home/hennig/ > >From 1 April > 2005: Department of Statistical Science, UCL, London > ############################################################## > ######### > ich empfehle www.boag-online.de > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >
Christian Hennig wrote:> Hi, > > I want to do something like this: > > par(mfrow=c(7,7)) > for (i in 1:49) > hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6), > main="",xlab="",ylab="",xaxt="n",yaxt="n") > > (Don't think about what RATDACOM and SUBJNO are.) > > I get an error > Error in plot.new() : Figure margins too large. > > 36 histograms with mfrow=c(6,6) work. > But the 36 histograms are then so small that I wonder why 49 do not fit. > It seems that though I have main="",xlab="",ylab="",xaxt="n",yaxt="n" the > area reserved for axes and labels is almost as large as it would be if I > would print a single histogram. The histogram itself only gets the remaining > space, which is very small (I could draw 36*4 histograms of this size on a > single page and the margins between them would still be OK). > > So the question is: > How do I tell R to print the essential histogram area without main, labs and > axes large enough that it looks well but small enough that 49 fit on one > page? (If I would draw them by hand, no problem...)Christian, set par(mar = ....) very small.... Uwe> Best, > Christian > > > *********************************************************************** > Christian Hennig > Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg > hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/ >>From 1 April 2005: Department of Statistical Science, UCL, London > ####################################################################### > ich empfehle www.boag-online.de > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Christian Hennig wrote:> Hi, > > I want to do something like this: > > par(mfrow=c(7,7)) > for (i in 1:49) > hist(RATDACOM[SUBJNO==i],breaks=0.5+(0:6), > main="",xlab="",ylab="",xaxt="n",yaxt="n") > > (Don't think about what RATDACOM and SUBJNO are.) > > I get an error > Error in plot.new() : Figure margins too large. > > 36 histograms with mfrow=c(6,6) work. > But the 36 histograms are then so small that I wonder why 49 do not fit. > It seems that though I have main="",xlab="",ylab="",xaxt="n",yaxt="n" the > area reserved for axes and labels is almost as large as it would be if I > would print a single histogram. The histogram itself only gets the remaining > space, which is very small (I could draw 36*4 histograms of this size on a > single page and the margins between them would still be OK). > > So the question is: > How do I tell R to print the essential histogram area without main, labs and > axes large enough that it looks well but small enough that 49 fit on one > page? (If I would draw them by hand, no problem...) > > Best, > Christian >You may want to look at ?histogram in package:lattice. set.seed(1) m <- 100 n <- 49 RATDACOM <- rnorm(m * n) SUBJNO <- rep(seq(n), each = m) histogram(~ RATDACOM | SUBJNO, layout = c(7, 7), strip = FALSE) --sundar
The pdf format works well for large numbers of plots on a single page. You can use a viewer like Acrobat Reader to zoom in to the areas of interest. Ideally you can arrange the plots in a meaningful order, maybe where both their horizontal and vertical position convey information. If you want something you can actually print or read without zooming in and if you can live with a slightly more abstract view of your data you might try putting multiple box plots in a single graph. Something like: n = 1000 m = 49 data = data.frame(x = rnorm(n), y = trunc(runif(n, min = 1, max = m + 1))) splits = split(data$x, data$y) o = order(sapply(splits, median), decreasing = TRUE) boxplot(splits[o], horizontal = TRUE)