[R] Add coordinates at specific points...

David Winsemius dwinsemius at comcast.net
Thu Jul 14 01:49:35 CEST 2011


On Jul 13, 2011, at 7:42 PM, JIA Pei wrote:

>
>
>
> Hi, Thanks David Winsemius:
>
> "mtext" works !! However, in R plot, "mtext" will automatically  
> overlap/overwrite the existing coordinates, which makes the  
> coordinates a messy.
> Refer to http://www.visionopen.com/Rplot.png , which is produced by  
> only 3 lines.
>
> dev.new(width = 640, height = 480)
> plot(sin, -pi, 2*pi)
> mtext(text="2.1000", side = 1, line = 1,  at = 2.1)
>
> In order to avoid the coordinates overlap, can I change the position  
> of "2.1000" from outside the box to inside the box? If possible, how  
> to?
> I tried “outer = FALSE,” nothing special happened ever !!

You should use text() rather than mtext() if you are going to plot  
within the "user area".

>
>
> cheers
> Pei
>
>
>
> On Wed, Jul 13, 2011 at 1:41 PM, David Winsemius <dwinsemius at comcast.net 
> > wrote:
>
> On Jul 13, 2011, at 1:22 PM, JIA Pei wrote:
>
> Hi, all:
>
> I used two lines of very simple code to draw a sin curve.
>
> dev.new(width = 640, height = 480)
> plot(sin, -pi, 2*pi)
>
> First look at:
>
> ?mtext   # then try
> mtext(text="2.5000", side = 1, line = 1,  at = 2.5)
>
>
>
> Now, I added a specific line (red line in the picture at
> http://www.visionopen.com/Rplot.png) by using abline.
> However, I still love to add the X-coordinate "2.50000" outside the
> rectangle box. How to do it in R?
> Right now, I'm using Windows Paint to add the characters "2.50000"  
> up to the
> plot drawn by R.
>
>
> -- 
> David Winsemius, MD
> West Hartford, CT
>
>
>
>
> -- 
>
> Pei JIA
>
> Email: jp4work at gmail.com
> cell:    +1 604-362-5816
>
> Welcome to Vision Open
> http://www.visionopen.com

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list