[R] Adding text to a plot

Patrick Hausmann patrick.hausmann at uni-bremen.de
Wed Jul 3 14:50:38 CEST 2002


Dear R-users,

again two question...

# Question 1
Adding two lines of text to a plot, I am using:

# ------------------------------- 
plot(k[,1], k[,2], pch=16, 
    ylim=range((min(k[,2])-0.2):(max(k[,2])+1)))     

a <- paste("Cor.:" ,cor(k[,2],k[,1]))
b <- paste(nrow(k), "Countries")

text(90, max((k[,2])-0.51), a)
text(90, max((k[,2])-0.83), b)
# -------------------------------
But the distance between the first and second line depends on the 
scale of the y-axis.

Is there a solution to put the lines in the upper right corner, 
independent of the y-scale?

# Question 2 
My data.frame looks like:
> u
      country     gdp50     w5073
1.AUS  AUS     77.15967   2.1708460
1.AUT  AUT     74.06830   1.8691745
1.BEL  BEL     77.87497   1.7547546
1.CAN  CAN     87.07300   1.3649655
[...]

To add labels on points in a plot I call: 
text(x=u[,2]+chw, y=u[,3], labels=levels(u[,1]), adj=0 )

How can I label only the datapoints for 'CAN' and 'AUS'?

Thanks for any help
Patrick
-------------
Patrick Hausmann
Friedrich-Wilhelm Str. 37 - D-28199 Bremen
Tel. +49 421 5980631 - Fax. +49 421 5980632
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list