Skip to content
Prev 265561 / 398502 Next

Add coordinates at specific points...

To add to what David and Duncan wrote: If you want to plot something at a point where the x coordinate is in user coordinates, but the y-coordinate is something like the middle of the plot, or 1/5th of the way from the top then you can use the grconvertY function along with the text function.

If you are going to have several labels and want to plot them so that they do not overlap then there are functions in the plotrix and TeachingDemos packages that can be used to spread labels.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of David Winsemius
Sent: Wednesday, July 13, 2011 6:11 PM
To: JIA Pei
Cc: r-help at r-project.org
Subject: Re: [R] Add coordinates at specific points...
On Jul 13, 2011, at 7:59 PM, JIA Pei wrote:

            
Have you worked through the examples on the help(text) page? This does  
not seem to be that difficult. Three essential arguments.... x,y and  
text. You are supposed to put for effort and show what code you have  
tried.

text(2.1, sin(2.1), labels="M=(2.1, sin(2.1) )")

You can play around with the positioning arguments, which IIRC are  
adj= and <something else>.
I don't see how that could be avoided. (Last color wins.) We don't  
have 3d glasses for our screens yet. Transparenct colors are  
available, but you don't seem to be ready for that yet.