[R] Trasparent graphs?

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Tue Oct 14 23:07:01 CEST 2003


Kenneth Cabrera wrote:

> Is it possible with pixmap library or image options?
> 
> Thank you again for your help.
> 
>

  If you have NA values in a matrix, they will be transparent when you 
use image() with the add=T option.

Example:

 > #make a matrix with all numbers, and show it:

 > z=matrix(outer(1:10,1:10,"*"),10,10)
 > image(z)

 > # now set anything over 50 to be NA
 > z[z>50] = NA

 > # plot some points, then add the image, showing the NA region to be 
see-thru:
 > plot(runif(1000),runif(1000))
 > image(z,add=T)

  Note that you cant have partial transparency - its all or nothing.

Baz




More information about the R-help mailing list