[R] par and a substitute for mtext to write one time a title per page

Aldi Kraja aldi at wustl.edu
Tue Mar 3 22:39:49 CET 2009


Hmm,

Reading some responses in the archives on mfg, the first one was simple 
the mfg does not control the pages.
After removing mfg=c(2,1), and leaving in the program only mfrow=(4,1) 
although I am printing one after the other in a loop, pages are printed 
and do not overwrite the same page.

So by defining mfrow only, one can extend to many pages with no problem.

Q2. Here is a small test program:
x<-rnorm(1000)
y<-rnorm(1000)
par(mfrow=c(2,1))
plot(x,y)
mtext("This is my title",3,line=1)
mtext("This is my title",3,line=2)
mtext("This is my title",3,line=3)
plot(x,y)

Is there a function that can print a title in every one new page outside 
of the space designated for graphs, instead of me finding the first 
graph that starts the page and there using mtext as shown above?

Thanks,

Aldi

Aldi Kraja wrote:
> RE: par and a substitute for mtext to write one time a title per page
> ============================================
>
> Hi,
> Q1. Is there way I can set mfg =c(2,1) which for me could have meant 2 
> pages and no split on the columns per page; and mfrow =c(4,1) which 
> for me it means 4 graphs per page in the par function?
> So if I have a pdf/png etc file I will output two pages with 4 graphs 
> for each, or modifiable depending on the case of data?
> I obtain the following:
>
> Error in par(mfg = c(2, 1), mfrow = c(4, 1)) :
>  parameter "i" in "mfg" is out of range
>
> steps:
> 1. open outstream: pdf(file="some_address_and_file.pdf")
> 2. do the corresponding loop to prepare the graphs for specific data
> 3. plot 2 or more pages of graphs with 4 graphs per page
> 4. close the outstream.
>
> Q2: with mtext function I can write in the outter margin including a 
> title as a header.
> Is there another way to write a title one time per page in these 
> multiple graphs, so I can save the graphs space per page?
>
> Thank you in advance,
>
> Aldi
>
> -- 
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--




More information about the R-help mailing list