Dear users,<br><br>I am quite new in this topic, so sorry in advanced if it is a simple question. <br>I have a couple of questions that may be some of you know and can help me to solve my problem.<br><br>1. I will like to add the name of the Chinese provinces in the map with the variable "var1", see below the code.<br>
<br>2. I will like to put different colors depending on different thresholds of the variable "var1" in a map with a leyend, but without using the defult scale.<br><br>Thanks in advanced.<br><br>Maria <br><br>---------------------------------<br>
The script is as following:<br><br>install.packages("sp")<br>library(sp)<br><br>#load the map #<br>mapchina<- url("<a href="http://www.gadm.org/data/rda/CHN_adm1.RData">http://www.gadm.org/data/rda/CHN_adm1.RData</a>")<br>
<br><br>load(mapchina)<br>mapchina=gadm<br><br>summary(gadm)<br><br><br>gadm$NAME_1 #shows the name of the Chinese regions<br><br>#create the vector of data that we want to draw in the Chinese map,. Notice that follow the same order that NAME_1 #<br>
<br>valor=c(99.09,70.62,0,49.13,42.13,40.53,46.10,40.36,0,71.87,38.71,<br>82.36,69.76,62.68,76.17,70.43,47.96,42.34,49.65,44.42,0,41.19,66.42,<br>61.04,76.75,82.75,44.69,75.37,20.53,21.25,38.10,89.74)<br><br>var1<-data.frame(valor)<br>
<br># add the vector of data into the map<br><br>mapa@data=data.frame(var1)<br><br>#plot the map<br><br>spplot(mapa,c("var1"))<br><br><div style="visibility: hidden; left: -5000px;" id="avg_ls_inline_popup"></div>