[R] Discrete values in levelplot?

Filipe Cadete fcadete at ebi.ac.uk
Fri Mar 26 16:08:31 CET 2010


Dear all,

I am trying represent a matrix of discrete values. At the moment I am using levelplot from the lattice package, but it seems to only work with numerical values. Is there an option in levelplot that will allow me to assign a color to a discrete value, or another package that will do the same?

To clarify, with levelplot I can represent a matrix such as:
     [,1] [,2] [,3] [,4]
[1,] "1"  "1"  "1"  "1" 
[2,] "1"  "5"  "5"  "2" 
[3,] "1"  "3"  "3"  "3" 

Which when plotted will have colors assigned based on a continuous scale of values (from 1 to 5 in this case).

What I am looking for is a way to represent a matrix of the type:

     [,1] [,2] [,3] [,4]
[1,] "A"  "B"  "C"  "D" 
[2,] "A"  "E"  "D"  "A" 
[3,] "B"  "C"  "C"  "C"

where each letter would have a specific color assigned to it.

Thank you in advance,
Filipe 

-- 
Filipe Tavares Cadete
PhD Student - Nick Luscombe Group
EMBL - European Bioinformatics Institute
Wellcome Trust Genome Campus
Hinxton, Cambridge
CB10 1SD
UK



More information about the R-help mailing list