[R] label point

Petr Pikal petr.pikal at precheza.cz
Tue Nov 29 08:05:10 CET 2005


Hallo

On 28 Nov 2005 at 21:33, Robert wrote:

Date sent:      	Mon, 28 Nov 2005 21:33:24 -0800 (PST)
From:           	Robert <samrobertsmith at yahoo.com>
To:             	r-help at stat.math.ethz.ch
Subject:        	[R] label point

>   Hi, I have a matrix:
>   [,1] [,2]
>   [1,] 11 31
>   [2,] 44 50
>   [3,] 23 100
>   [4,] 90 31
>   I use plot to draw the four points. Is there any way to label the
>   point? for insatnce, for (11,31), it is "1", for (44,50), it is "4".
>   Thanks!
> 


label.vec<-c(1, 4, l2, l3.....)
plot(matrix)
text(matrix, label.vec)

Should do the trick but it overplots your points, so you need to 
shift positions e.g. by

text(matrix+c(some offset,0), label.vec)

HTH
Petr




> 
> 
> 
> ---------------------------------
> 
>  [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list