[R-sig-Geo] color category SpatialGridDataFrame SpatialPolygonsDataFrame Corine Land Cover Global Land Cover 2000

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Thu Dec 31 12:15:04 CET 2009

Renaud Lancelot a écrit :
> Dear Patrick,
> I recently met this issue. I finally used image() on the 
> SpatialGridDataFrame, defining the appropriate colors using the col 
> argument (étonnant, non ;-)). I have defined the legend using 
> legend(), and I used split.screen() to arrange the plots. 

It was my point. In this case, you must have defined many breakpoints 
(to create appropriate intervals for each code) to get all the codes at 
the right color, which is quite tedious, isn't it ? I wonder if this can 
be simplified. Ideally importing a color table. Maybe a new function to 
write (thus to put on the many pending "to do").

> If you wish, I can send you the whole stuff (data and code) in a 
> private message (huge datasets).
I appreciate the proposal, but I was just interested in some general 
principles and advise...

Have a nice evening...



> Renaud
> Patrick Giraudoux a écrit :
>> Dear all,
>> I am wondering what is the safest way to handle colors when 
>> SpatialGridDataFrame data are categories. spplot() or image() are 
>> extremely convenient when attributes are continuous variables or so 
>> (eg altitude, rainfall, etc...), but the colorRamp() system and the 
>> col.regions, col arguments, though extremely powerful in other cases, 
>> is not really adapted to category data such as Corine LandCover or 
>> Global Land Cover 2000 codes. Thus to link pixels to the right color 
>> may be quite tedious (however I may have missed something...).
>> One option I though about was to change raster into shapefile (or 
>> SpatialGrid into SpatialPolygons objects), but again the straight way 
>> to get right colors is not evident.
>> Any idea ?
>> Patrick
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

More information about the R-sig-Geo mailing list