[R] adjusting levelplot color scale to data

Lanna Jin lannajin at gmail.com
Mon Nov 7 04:08:44 CET 2011


Hi guys,

I have a matrix with values varying from approximately -0.7 to 0.33 that I
want to create a heatmap/levelplot with.

When I execute the levelplot function for my matrix, I end up getting colors
that are adjusted to the max and min rather than around 0. In other words,
ideally I would like to have a color ramp that goes from red (negative
number), to white (0), to blue (positive); however, right now the value 0 is
in the blue.

Any insight on how to address this problem?

Thanks in advance!

example...
my matrix "y" looks something like this 
                 A                 B                      C                  
D                    E
  row1         -0.5046406 -0.021579587    -0.4419101 -0.2999195330   
-0.4845047   
  row2         -0.3070091 -0.059065936     0.3329806 -0.0519335420   
-0.5766368      
  row3         -0.7271707  0.073282855    -0.3181990 -0.2485017700   
-0.5732781     
  row4          0.3329806 -0.017762750    -0.1513197 -0.1016354970    
0.2528442  

levelplot(y) yields a color scale from red (-0.8 to 0.2) to blue (0.2 to
0.4)
I'd want the color scale to be from red (-0.8 to 0) to blue (0 to 0.4)



-----
Lanna
--
View this message in context: http://r.789695.n4.nabble.com/adjusting-levelplot-color-scale-to-data-tp3997342p3997342.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list