For your specific question, Jim's answer of staxlab is the best, but for 
general placing of text or other graphics elements relative to figure, plot, or 
device look at the grconvertX and grconvertY functions.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Martin Hughes
> Sent: Thursday, October 07, 2010 4:30 AM
> To: r-help@r-project.org
> Subject: [R] text/mtext axis labels on graphs
> 
> 
> Hello everyone
> 
> I have problem with axis labels on graphs, I have my code as below:
> 
> plot(0,0,xlim=c(1,ncol(PA)),ylim=c(1,nrow(PA)),main="Stratigraphic
> Range",xlab="Time
> Bins",ylab="Taxa",cex.axis=1.5,cex.lab=2,cex.main=2.5,mgp=c(5,1.5,0),xa
> xt="n")
> 
> text(1:(length(strat_name)), y=  0, adj=1,
> srt=45,labels=strat_name,xpd=TRUE, cex=1) #adds text to x axis giving
> the strat names
> abline(v=(1:ncol(PA))+.5,col="grey",lty=3)
> 
> cl <- rep(1,nrow(PA))
> cl[DistM$kill] <- 2
> for (i in 1:nrow(PA)) segments(min(which(PA[i,]==1))-.5,i,
> max(which(PA[i,]==1))+.5,i,lwd=3,col=cl[i])
> 
> 
> My problem lies with the x axis tick labels, I want my own labels
> added in so removed the one the plot function adds in normally.
> 
> I use the text function as it allows me to fit my own text tick labels
> at an angle, HOWEVER the text function is VERY sensitive to the Y
> axis, I have multiple graphs on a page, each with a different y axis,
> so the labels move up and down depending on the scale of the Y.
> 
> 
> I tried using mtext which lets you put the text a certain distance
> from the x margin line, HOWEVER this function does not let you tilt
> the text to be an an angle
> 
> 
> Can anyone tell me of a way I can have both - ie text that is a
> specified distance from the margin AND tilted at and angle
> 
> Thanks
> Martin
> 
> 
> 
> 
> --
> Martin Hughes
> MPhil/PhD Research in Biology
> Rm 1.07,  4south
> University of Bath
> Department of Biology and Biochemistry
> Claverton
> Bath    BA2 7AY
> Tel: 01225 385 437
> m.hug...@bath.ac.uk
> http://www.bath.ac.uk/bio-sci/biodiversity-lab/hughes.html
> 
> ______________________________________________
> R-help@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.

______________________________________________
R-help@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.

Reply via email to