[R] writing text on graphics' window

Duncan Murdoch dmurdoch at pair.com
Sun Mar 21 12:58:03 CET 2004


On Sun, 21 Mar 2004 11:07:01 +0000, you wrote:

>Hi,
>
>Does anyone know of a method for writing text to the graphics window, 
>where there is *no* plot? Basically, I have developed a 'significance 
>test' and I would like the output on the graphics window to say 
>something about the input parameters and the stats of the significance test.
>
>Any help would be appreciated.

You need to make sure a graphics device is active and establish a
coordinate system there.  The easiest way to do that is to make a call
to plot() with everything turned off:

 plot(0:100,0:100,type='n',axes=FALSE,xlab="",ylab="")

You may also want to reduce the "margins" if you want your output to
take up the full frame, e.g.

 oldmargins <- par(mar=c(0,0,0,0))
 plot(0:100,0:100,type='n',axes=FALSE,xlab="",ylab="")

 text(c(0,100,0,100),c(0,0,100,100),c('bottom left',
      'bottom right','top left','top right'))

 par(oldmargins)

Duncan Murdoch




More information about the R-help mailing list