R:Custom color palette in map with spplot
问题 I am struggling with introducing a custom color palette on several polygons using spplot from the sp package. I am plotting several fields and want to show my rating , which can have the values 0,1,2,4 or 5. I need to use custom colors for that. What I tried is: spplot(Map,zcol="Rating", col.regions=c("0"="#00cc00","1"="#ffff66","2"="#e5c100", "3"="orange","4"="#ff5e5e","5"="red"), colorkey=TRUE) However, it is producing a repetition of colors like in the map below. How can I solve this? I