[R-sig-Geo] How to change scale labeling in spplot

Thomas Adams te@3rd @end|ng |rom gm@||@com
Mon Aug 10 22:01:33 CEST 2020


Hi all,

I have searched for examples to change the labeling for raster data (two
panels) consisting of integer values (1, 2, and 3). In the scale I want to
label these as "Af", "Am", Aw".

My code looks like:

colp <- colorRampPalette(c("#960000", "#FF0000", "#FFCCCC"))
brks<-seq(0,3,1)
spplot(KG_haiti,xlim=c(-8313027,-7959668),ylim=c(2017552,2297053),at=brks,col.regions=colp(length(brks)-1),ylab="Climate
Class",main="Koppen-Geiger Climate Classification for\nClimate Years
1981-2010 and El Nino Years",names.attr=c("Climate Normal","El
Nino"),colorkey=list(labels = list(labels = c("Af","Am","Aw"))))

I'm getting just the 3 colors, but the labels "Af", "Am", Aw" are repeated
across each color; I need to have each color associated with just one of
the labels. Obviously, I'm doing something wrong...

I just cannot figure out how to do this.

Regards,
Tom

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list