[R] Create a common wafer map colour scale for different data sets

BARLAS Marios 247554 Marios.BARLAS at cea.fr
Sun Jul 24 17:14:49 CEST 2016


Hello Every1, 

I'm working on analysing some data and I want to make some cartography maps. 

Since I treat data in batch, I need to have a common reference colour scale for all the datasets I need to plot. This is important otherwise it becomes hard to quickly assert visually changes from one experiment to another if the colour scale resets all the time. 

So I though of finding the min and max value of my data values and create a colour scale versus that. 

Nonetheless the code does not work as intended, 

Here is a part of the code: 


  r.colour.map <- c("lightgreen", "darkgreen", "yellow","red" )

  r.range.breaks <- c(0, 1.5e4, 1e5, r.max )/r.max  

  r.breaks.guide <- c(0, 1.5e4, 1e5, r.max )  # r.max is function paramer
  g.map <- ggplot(dies.in.wafer, aes(X, Y)) + # data set to be plotted and X,Y coordinates
    geom_raster(aes(fill = R))+                       # values to be mapped
    scale_fill_gradientn(name="R", na.value = "grey50", colours = r.colour.map, values = r.range.breaks, breaks=r.breaks.guide )
  g.map

This does no work as intended. My intention is to have a code that interpolates colors according to set value ranges:

for values from 0 to 1.5e4 interpolate gradient between lightgreen and green
for values from 1.5e4 to 5e5 interpolate gradient between green and yellow
for values from 5e5 to max  interpolate gradient between yellow and red


Any1 has some ideas of what I'm doing wrong, or workarounds ?

Thanks in advance!

Regards,
Marios Barlas


More information about the R-help mailing list