Skip to content

pass longer arguments to adj of text()

6 messages · Thomas Steiner, Brian Ripley, Peter Dalgaard +1 more

#
Hi,

text()'s pos does handle more dimensional labels, while adj does not -
or how can I pass an array to text() and use the adj argument (skyblue
text)?

plot(-1:1,-1:1)
text(c(0,0),c(0,0),c("a","b"),pos=c(1,2),col="red")
text(c(0,0),c(0,0),c("a","b"),adj=cbind(c(1,2),c(1,1)),col="skyblue")

Thomas
#
...and the offset argument can't handle arrays either:

text(c(0,0),c(0,0),c("a","b"),pos=c(1,2),offset=c(1,0.5),col="darkgreen")

The second argument does not have any effect.
Can I pass arrays to text and use diffent locations?
Thomas

PS: I use R version 2.5.0 (2007-04-23) under Win2000.
#
Why do you expect this to be vectorized when the help page clearly says 
otherwise?  See

      adj: one or two values in [0,1] which specify the x (and
           optionally y) adjustment of the labels.  On most devices
           values outside that interval will also work.

What is wrong with two or more text() calls?

NB: library(fortunes); fortune("WTFM") applies.
On Mon, 20 Oct 2008, Thomas Steiner wrote:

            

  
    
#
Brian, thank you for your reply.
Sure, it's in line with the help, no problem there. I just asked if
this feature is somehow possible.
I expected it, because "pos" does take arrays and it "overrides any
adj value given" (see help). So if "pos" does, why not "adj"?
it's quicker and more beautiful.
See my code at the end (last loop) of
http://commons.wikimedia.org/wiki/Image:Sonnenstand.png

Thomas
This one I didn't get. They help to do it without a loop?
#
Thomas Steiner wrote:

            
No.

 > library(fortunes); fortune("WTFM")

This is all documented in TFM. Those who WTFM don't want to have to WTFM 
again
on the mailing list. RTFM.
    -- Barry Rowlingson
       R-help (October 2003)

(TFM == The Friggin' Manual (or thereabouts), W==Write, R==Read)
#
On Mon, 20 Oct 2008, Thomas Steiner wrote:

            
Perhaps

 	mapply( text, px, py, angle2date(jp), adj=adj, MoreArgs=list(cex=0.85))

is more to your liking?

HTH,

Chuck
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901