Thursday, November 7, 2013

R繪圖 -- map plotting

Map plotting needs shape file to do the job; however, it might not be an easy job to do. There are plenty of shape file but you do not have the freedom to adjust the region with your own perference. Therefore, addland(), a function from R package clim.pact is quite a surprise to the map plotting.

FYI, clim.pact is not on CRAN, so you have to downlad through its achieve page. Particularly, if you are a window user, then you will have to install Rtools before you pack "tar.gz" file in R. Check the website below, if you need it.

http://cran.r-project.org/bin/windows/Rtools/

After installing Rtools, then you can unpack your clim.pact by the following comment

install.packages(" path to your clim.pact.tar.gz ", repos=NULL, type="source")

library(clim.pact)
plot(c(117,123),c(21,27),type="n")
addland()
grid()



So easy! What a surprise!

No comments: