[R] legend() with option adj=1

Jerome Asselin jerome at hivnet.ubc.ca
Wed May 21 01:52:30 CEST 2003


Hi there,

I want to justify to right the text of my legend. Consider this short 
reproducable example.

x <- 1:5
y1 <- 1/x
y2 <- 2/x
plot(rep(x,2),c(y1,y2),type="n",xlab="x",ylab="y")
lines(x,y1)
lines(x,y2,lty=2)
legend(5,2,c("1,000","1,000,000"),lty=1:2,xjust=1,yjust=1)
legend(5,1.5,c("1,000","1,000,000"),lty=1:2,xjust=1,yjust=1,adj=1)

Now, I would like to right-justify the text of the legend. As you can see, 
the option adj=1 does not give satisfactory results.

Is this a bug or is there an easy way that I'm missing?

Thanks,
Jerome

-- 

Jerome Asselin (Jérôme), Statistical Analyst
British Columbia Centre for Excellence in HIV/AIDS
St. Paul's Hospital, 608 - 1081 Burrard Street
Vancouver, British Columbia, CANADA V6Z 1Y6
Email: jerome at hivnet.ubc.ca
Phone: 604 806-9112   Fax: 604 806-9044




More information about the R-help mailing list