Dear R users,

I am trying to reverse the orientation of axis labels and title in the right 
margin of a plot, so that they read from top to bottom. I know that this can be 
done using text() as follows: 

par(mar=c(5,4,4,4)+.1)
plot(1:4,las=0)
par(new=T)
y <- rnorm(4)
plot(y,axes=FALSE,ann=FALSE,pch=17)
axis(4,labels=FALSE)
par(xpd=TRUE)
text(x=par("usr")[2]+.25,y=axTicks(4),labels=axTicks(4),srt=-90)
text(x=par("usr")[2]+.5,y=sum(par("usr")[3:4])/2,labels="titel",srt=-90)
par(xpd=FALSE)

the problem is that I have to manually reset the x and y coordinates of the 
text whenever the plot is resized. This is problematic if I want to automatize 
the production of a number of plots (or produce different output formats), or 
to make sure that the labels and title in the right axis are at an equal 
distance from the plot as the labels and title on the left axis. Now I can only 
guess it on sight. 

mtext() allows me to set the distance, but not to reverse the orientation of 
the text. 

I could use text() to also produce the left axis, like that labels on both 
sides can be at the exact same distance from the plot, but then I want to 
determine the plot margins relative to the plot dimensions. 

Does anyone see a solution to my problem that doesn't involve trial and error 
for the x coordinate?

thanks
Karel



_________________________________________________________________


        [[alternative HTML version deleted]]

______________________________________________
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