R语言学习笔记:绘制地图
在R中画地图先从简单的maps包开始。
library("maps")
在这个maps包中有一些数据集,用命令data(package=”maps”),可以看到如下数据:
canada.cities Database of Canadian cities
county.fips FIPS county codes for US County Map
countyMapEnv United States County Map
franceMapEnv France Map
italyMapEnv Italy Map
nzMapEnv New Zealand Basic Map
ozone Sample datasets
state.carto.center United States State Population Cartogram Map
state.cartoMapEnv United States State Population Cartogram Map
state.fips FIPS state codes for US 48 State Map
state.vbm.center United States State Visibility Base Map
state.vbmMapEnv United States State Visibility Base Map
stateMapEnv United States State Boundaries Map
unemp Sample datasets
us.cities Database of US cities
usaMapEnv United States Coast Map
votes.repub Sample datasets
world.cities Database of world cities
world2MapEnv Pacific Centric Low resolution World Map
worldMapEnv Low resolution World Map
画出美国各州的边界:
map('state', panel.first=grid())
axis(1,lwd=0)
axis(2,lwd=0)
axis(3,lwd=0)
axis(4,lwd=0)
box()
标出美国的城市:
data(us.cities)
points(us.cities$long, us.cities$lat, pch=19)
标出人口大于一百万的城市
cities <- us.cities[us.cities$pop > 1000000,]
points(cities$long, cities$lat, pch=19)
text(cities$long, cities$lat, cities$name, col="blue", cex=0.8, pos=1)
----==== Email: slofslb (GTD) qq.com 请将(GTD)换成@ ====----
版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)
作者:申龙斌的程序人生
---- 魔方、桥牌、象棋、游戏人生...
---- BASIC、C++、JAVA、C#、Haskell、Objective-C、Open Inventor、程序人生...
---- GTD伴我实现人生目标
---- 区块链生存训练
---- 用欧拉计划学Rust编程
---- 申龙斌的读书笔记(2011-2019)
----