[R] Levelplot and NAs

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Nov 6 14:35:11 CET 2003

On Thursday 06 November 2003 05:33, AJ Smit wrote:
> Dear all
> How does one get a levelplot (lattice library) to plot NAs in a
> different colour to that specified in the default colorkey?

You can't do it. If you don't need to distinguish NA's and missing points 
(that is (x,y) pairs that are completely absent from the data, as opposed to 
being present with a z-value of NA), you can use panel.fill() to fill the 
background with your 'NA' color. Something like


          panel = function(...) {
              panel.fill(col = "red")

Otherwise, change NA's to some suitable number before plotting.


More information about the R-help mailing list