一个使用base
plot 和 packages的简单示例sp
,rgdal
并且maptools
:
library(sp)
library(maptools)
library(rgdal)
xy <- data.frame(lon=c(-130,110,3,45),lat=c(60,-10,50,30)) #Some coordinates
value <- data.frame(value=c(1.5,0.8,2.3,2)) #Some values for the point size
df <- SpatialPointsDataFrame(xy,value,proj4string=CRS("+proj=lonlat"))
dfMoll <- spTransform(df, CRS("+proj=moll")) #Mollweide projection of the data
data(wrld_simpl) # A base world map
wrld_moll <- spTransform(wrld_simpl, CRS("+proj=moll")) # ... that we projects as well
plot(wrld_moll) #... and plot
points(dfMoll, cex=dfMoll$value, pch=20, col="red") #...with our data points