[R] Space for X and Y axis labels

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Mar 24 16:27:38 CET 2007


Your exampleisnot reproducible, but I guess you want to change the 
par("mar") setting ...

Uwe Ligges


Joseph Wakeling wrote:
> Hello all,
> 
> I'm having a bit of a problem with x and y axis labels.  Two things:
> first, if I want to create a plot with,
> 
>     plot.new()
>     plot.window(.....)
>     axis(1)
>     axis(2)
>     lines(...)
>     points(...)
> 
>     [etc.]
> 
> ... where do I introduce the xlab=... and ylab=... commands?  I
> attempted this in plot.window() but no labels showed up.
> 
> Second, here's a bit of real code...
> 
> 	postscript(file="RPDfig.eps",onefile=FALSE,
> 	 +         horizontal=FALSE,paper="special",height=8.3,
>          +         width=11.7)
> 	matplot(2:length(PRICE),t(NWpd),type="l",xlim=c(0,200),
> 	 +      ylim=c(-0.1,0.1),xaxs="i",yaxs="i",xlab="Time",
> 	 +      ylab=expression(over(x,y)),bty="n")
> 	points(2:length(PRICE),Ppd,col="red")
> 	dev.off()
> 
> Here the y label is meant to be x over y (a fraction), but the top part
> of the fraction is cut off by the border of the graphic.  How can I fix
> this, either by creating extra space for the label or by insisting that
> the boundary of the graphic be extended to embrace the whole of the
> label?  I've tried setting xpd=TRUE in the matplot command, but I'm not
> sure that is the correct option (and it makes no difference).
> 
> Many thanks,
> 
>     -- Joe
> 
> ______________________________________________
> 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