[R] splot.screen: multiple plots

BXC (Bendix Carstensen) bxc at steno.dk
Mon Dec 27 12:10:19 CET 2004


You probably want to use something like

par( mar=c(0,0,0,0), oma=c(3,3,2,3) )

which will put all your plots next to each other with no space between
them
and with a reasonable margin outside ("oma").

Take a print of the (rather long) help page for "par", and bring it with
you 
wherever you go, so youcan study it in waiting lines, traffic jams,
trains etc.
It's boring to learn but useful to know all those weird arguments...

best
Bendix Carstensen
----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
bxc at steno.dk
www.biostat.ku.dk/~bxc
----------------------



> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Anne G
> Sent: Monday, December 27, 2004 11:55 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] splot.screen: multiple plots
> 
> 
> I have multiple conditions that I would like to plot in a
> grid. To save space, I don't need the ticks, labels etc on
> the plots which are not on the outside.
> 
> I tried split.screen, but if it is clearer to use, it seems 
> pretty rigid since it decides of each screen size apriori 
> while I need more space for the left column and top or bottom 
> row screens than for the other plots.
> 
> axis(1,tick=FALSE) does not seem to do anything, asp=1 does
> not seem to do anything either. par(pty="s") gave it a 
> somewhate square aspect, But there is a lot of empty space 
> which must have to do with margins, but setting the margins 
> did not seem to change anything.
> 
> I think I have seen examples like mine in a book, but it
> might have been a book on Splus. Do you know where I can
> find an example of what I am looking for.
> 
> thanks
> Anne
> ----------------------------------------------------------
> here is a simplified example with the same data for all
> plots
> 
> X<-c(1.00000  3.63168  6.44916 10.17572 20.47440)
> Y<-c(0.26 0.56 0.80 0.92 0.88)
> 
> numFreq<-7
> numdist<-8
> 
> coefind <- 1
> quartz(display = "", width =15, height = 10, pointsize = 9,
>             family = "Helvetica", antialias = TRUE,
> autorefresh = TRUE)
> par(pty="s")
> split.screen(c(numdist,numFreq))
> 
> for (inddist in 1:numdist)
> 	{
> 	for (indFreq in 1:numFreq)
> 		{
> 		indscreen<- indFreq+(inddist-1)*numFreq
> 
> 			screen(indscreen)
> #			mar<-c(1,1,1,0)
> 
> 			plot(X,Y,
> log="x",col="red",xlim=c(1,100),ylim=c(0,1),lab=5, xlab="",
> ylab="")
> 			axis(1,tick=FALSE)
> 			axis(2,tick=FALSE)
> 
> 			if( inddist==1)
> 				{
> 				title(main=sprintf('Freq =
> %d',indFreq));
> 				}
> 
> 			if( indFreq==1)
> 				{
> 				axis(2, tick=TRUE)
> 				title(ylab=sprintf('dist =
> %d',inddist));
> 				}
>  			if (inddist==8)
> 				{
> 				axis(1,tick=TRUE)
> 				title(xlab="perc face")
> 				}
> 
> 			coefind <- coefind+1
> 		}
> 	}
> close.screen(all = TRUE)    # exit split-screen mode
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list