[R] changing the position of the y label (ylab)

Etienne etiennesky at yahoo.com
Tue Jun 26 00:49:28 CEST 2007


Thanks (Merci) Christophe!

that did it

--- Christophe Bonenfant
<bonenfan at biomserv.univ-lyon1.fr> wrote:

> Hi Etienne - consider to use the mtext function:
> 
>  > par(mar=c(5.1,5.1,4.1,2.1))
>  >
>
plot(c(1979,2003),c(40,50),ylim=c(1,73),lab=c(20,10,1),
>
pch=21,col='blue',bg='blue',axes=FALSE,xlab="",ylab="",font.lab=2)
>  > box()
>  > axis(1,las=2)
>  >
>
axis(2,las=2,labels=c('JAN','FEB','MAR','APR','MAY','JUN','JUL',
>
'AUG','SEP','OCT','NOV','DEC','JAN'),at=seq(from=1,to=73,by=6))
>  > axis(3,labels=FALSE)
>  > axis(4,labels=FALSE,at=seq(from=1,to=73,by=6))
>  > mtext("Years", 1, 3.5, cex = 1.7)
> # first interger is the axis number, second number
> is the distance to 
> the axis
>  > mtext("Onset/Withdrawl Date", 2, 4, cex = 1.7)
> 
> see ?mtext
> 
> Christophe
> 
> Etienne a écrit :
> > How can I change the position of the ylab, after
> > enlarging the margins with par(mar=...)? 
> > 
> > Here is the relevant code snippet
> > 
> > ----
> > par(mar=c(5.1,5.1,4.1,2.1))
> >
>
plot(c(1979,2003),c(40,50),ylim=c(1,73),lab=c(20,10,1),pch=21,col='blue',bg='blue',axes=FALSE,xlab="Years",ylab="Onset/Withdrawl
> > Date",font.lab=2)
> > box()
> > axis(1,las=2)
> >
>
axis(2,las=2,labels=c('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC','JAN'),at=seq(from=1,to=73,by=6))
> > axis(3,labels=FALSE)
> > axis(4,labels=FALSE,at=seq(from=1,to=73,by=6))
> > ----
> > 
> > Thanks
> > 
> > ______________________________________________
> > 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
> > and provide commented, minimal, self-contained,
> reproducible code.
> > 
> > 
>



More information about the R-help mailing list