2

I have a spatial polygon data-frame and I am trying to plot a heatmap via spplot. It's a map of Europe and the values for the heatmap are in a column of the data-frame. Plotting it works fine but I have some NAs in the column used for the colors and these countries are just not colored, so they are white. I'd really like them to be grey, however.. I have no idea how I can do this in spplot.. can anyone help?

  • A reproducible example is always welcome. – user32309 Aug 7 '14 at 2:54
  • eu1<-merge(eu,adi1,by.y="V1",by.x="iso_a2",all=T) pal<-colorRampPalette(c("red","yellow","green"))(n=length(levels(eu1$V2))) spplot(eu1,"V2",col.regions=pal) that is what my code looks like.. dont know how to paste a screenshot of the data-frame in here. V2 is a vector with direct investment data i want to visualize. after merging, there are some NAs, and thats ok. i just want them to be grey, but the regions.col function does not seem to let me discriminate between rows of the data-frame. is there something other than spplot that could work? – clempe Aug 7 '14 at 6:50
  • Better to provide a reproducible example, and to edit your initial post to include it. – user32309 Aug 7 '14 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.