# [R] Relocating Axis Label/Title --2

Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com
Thu Aug 9 03:36:34 CEST 2007

```You don't need to move anything.   Just allocate more room for what you have

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
###################
par(mar = c(4.5, 4.5, 1, 1) + 0.1)#########
###################
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))), xlab =
expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()

Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Lorenzo Isella
Sent: Wednesday, August 08, 2007 12:53 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Relocating Axis Label/Title --2

Apologies for the previous mail (I sent it off too early by mistake).
This is the correct example:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()

With mgp() I can tune the distance between the ticks and the tick
labels, but how can I move the axis label? I would like to move the
one along y to visualize correctly the exponent "3".

Kind Regards

Lorenzo

On 08/08/07, Lorenzo Isella <lorenzo.isella at gmail.com> wrote:
> Dear All,
> I am experiencing some problems with relocating an axis title.
> I visited the following link before posting:
>
> http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html
>
> But this is not entirely what I would like to do
> Consider the example below:
>
> rm(list=ls())
> D_mean<-seq(-5,5,length=100)
> y<-exp(-D_mean^2/5)
> pdf("my.pdf")
> plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
> ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
> xlab = expression(paste(D[agg]," [nm]")),
> cex.lab=1.2
> )
> title(2, mgp=c(0, .3, 0))
> dev.off()
>
> I have the problem that the "3" in cubic centimeters (on the y axis)
> is somehow "cut" in the pdf file I generate. Everything would be fine
> if I could shift a bit the title of the y axis.
> It must be trivial, but so far I have not managed to do it.
> Any suggestions?
> Many thanks
>
> Lorenzo
> I tried playing with the mgp parameter, but I managed to move the
>

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help