Cpt*_*emo 10 maps plot r shapefile
我有一个简单的shapefile我想用一般情节绘图()(我注意到ggplot在绘制地图时非常慢).
我可以用代码正确地绘制形状
library(maptools)
map_shp <- readShapePoly(map_filepath)
map <- fortify(map_shp)
plot(map)
Run Code Online (Sandbox Code Playgroud)
但是我怎样才能定义线条的颜色和宽度?
Jos*_*ien 20
如果您没有开始使用ggplot2来处理所有事情,您可以回避fortify()并使用sp包的完善工具来绘制类的对象SpatialPolygons*:
library(rgdal) # For readOGR(), generally preferable to readShapePoly() IMHO
library(spdep) # For the "columbus.shp" file that ships with the package
map <- readOGR(dsn = system.file("etc/shapes", package="spdep"),
layer = "columbus")
plot(map, border="red", lwd=3)
Run Code Online (Sandbox Code Playgroud)
