[R] Conditional plot labels
Greg Snow
Greg.Snow at imail.org
Thu Apr 30 22:53:29 CEST 2009
Here is one example that moves the axes to the outer margins, play with the different settings to see the effects:
par(oma=c(3,3,3,3)+.1, mar=c(0,0,0,0)+0.1, mfrow=c(3,3))
for (i in 1:9) {
plot( runif(10*i), runif(10*i), ann=FALSE, xlim=c(0,1), ylim=c(0,1),
xaxt='n', yaxt='n' )
if( i %% 3 == 1 ) axis(2, outer=TRUE)
if( (i-1) %/% 3 == 2 ) axis(1, outer=TRUE)
}
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Christian Bustamante
> Sent: Saturday, April 25, 2009 6:31 PM
> To: r-help at r-project.org
> Subject: [R] Conditional plot labels
>
> Hi all,
> I'm trying to do multiple graphs in a window like this:
>
> ___ ___ ___
> ylab |__| |__| |__|
> ___ ___ ___
> ylab |__| |__| |__|
> ___ ___ ___
> ylab |__| |__| |__|
> xl xl xl
>
> If I try to put the labels manually, some graphs become smaller than
> other and the output is really ugly.
> In the thread title I put the word "conditional" because I'm trying to
> do a function, and in that function I want to print ylabels if the
> plot positions is at first column of the graph matrix, and xlab if the
> position is at last row of matrix.
>
> How can i achive this two things?
>
> Thanks for your help
>
> --
> CdeB
>
> ______________________________________________
> 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