[R] text bubble (rectangle)?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Jun 4 09:43:05 CEST 2006


"ivo welch" <ivowel at gmail.com> writes:

> Dear R wizards:  sorry to bug everyone twice in one day.
> 
> I would like to annotate my graph by putting text strings into
> rectangle boxes with a little cartoon-like bubble with a lid pointing
> to a specific location.  I can draw some sort of bubble-with-lid using
> the R primitives.  (has anyone done something like this already?)
> 
> the problem where I am stuck is that the width of the rectangle must
> depend on the length and font of my string.  is there a way to obtain
> the lower left and upper right location of a text string that R drew?
> (this would be good return values for the text() function, wouldn't
> it?)
> 
>   bubble.annotate <- function( x, y, xlid, ylid, textstring ) { HELP }
>   bubble.annotate( 19871010, 20, 19871019, 13, "Black Monday" );
> 
> [and thanks, gabor, for explaining the ifelse tricks with dates to me.]

Have a look at strwidth/strheight.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list