Re: [R] Labels for Points- 2 character labels?

2006-10-19 Thread David Barron
Is this what you want?

 plot(e,n)
 text(e,n,labels=e_order,pos=4)


On 18/10/06, ableape [EMAIL PROTECTED] wrote:
 I would like to be able to label each point in a scatter plot with
 the numeric order of that point. for example, I create the following plot:

 plot(e,n)
 #
 # now I go back and create my labels
 #
 for(i in 1:length(e)) {# lets say e 10
 pc - as.character(e_order[i])   # e_order has an
 integer array 1,4,3,2... which is the order of e
 points(e15[i], n15[i],pch=pc)# this will plot
 0-9 as data labels

   }
 #
 The above works for single characters.  Now if the length of e[] is
 greater than 9, the character string converted by as.character will
 yield more than one digit. At this point, my labeling trick fails:-(

 1) is there a way to create two character labels for a plot?
 2) Or even better, is there a way to do what I am trying to
 do.  Label each point by its numeric order?

 Thanks for your help.

 Renaldo

 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] Labels for Points- 2 character labels?

2006-10-18 Thread ableape
I would like to be able to label each point in a scatter plot with 
the numeric order of that point. for example, I create the following plot:

plot(e,n)
#
# now I go back and create my labels
#
for(i in 1:length(e)) {# lets say e 10
pc - as.character(e_order[i])   # e_order has an 
integer array 1,4,3,2... which is the order of e
points(e15[i], n15[i],pch=pc)# this will plot 
0-9 as data labels

  }
#
The above works for single characters.  Now if the length of e[] is 
greater than 9, the character string converted by as.character will 
yield more than one digit. At this point, my labeling trick fails:-(

1) is there a way to create two character labels for a plot?
2) Or even better, is there a way to do what I am trying to 
do.  Label each point by its numeric order?

Thanks for your help.

Renaldo

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Labels for Points- 2 character labels?

2006-10-18 Thread Robert Baer
I think you want to use text()

 x=1:15; y=16:30
 plot(x,y)
 text(x,y, as.character(x), pos=4)

- Original Message - 
From: ableape [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Wednesday, October 18, 2006 4:59 PM
Subject: [R] Labels for Points- 2 character labels?


I would like to be able to label each point in a scatter plot with
 the numeric order of that point. for example, I create the following plot:

 plot(e,n)
 #
 # now I go back and create my labels
 #
 for(i in 1:length(e)) {# lets say e 
 10
pc - as.character(e_order[i])   # e_order has an
 integer array 1,4,3,2... which is the order of e
points(e15[i], n15[i],pch=pc)# this will plot
 0-9 as data labels

  }
 #
 The above works for single characters.  Now if the length of e[] is
 greater than 9, the character string converted by as.character will
 yield more than one digit. At this point, my labeling trick fails:-(

 1) is there a way to create two character labels for a plot?
 2) Or even better, is there a way to do what I am trying to
 do.  Label each point by its numeric order?

 Thanks for your help.

 Renaldo

 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@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
and provide commented, minimal, self-contained, reproducible code.