如何在基地的南中国海绘制中国地图

问题描述 投票:0回答:2
我想获得以南中国海框架为附件的中国地图。 中国边界线和行政形状文件可以从

Https://github.com/jimrpy/jimrpy.github.io/blob/master/epidemiology/archive.zip.x 我的代码如下,我不知道如何设置“ usr”,如何修改代码?

library(maps) library(rgdal) china_blank <- readOGR(dsn = "~/China/", layer = "China_Province") china_line <- readOGR(dsn = "~/China/", layer = "China_Boundary_Nineline") china_blank <- spTransform(china_blank, CRS("+init=epsg:4326")) china_line <- spTransform(china_line, CRS("+init=epsg:4326")) map(china_blank) map.axes() par(usr = c(73, 136, 0, 54)) rect(xleft = 107, ybottom = 0, xright = 122, ytop = 21, col = "white") map(china_line, xlim = c(108, 122), ylim = c(0, 21), add =T)

enter image description here

r gis
2个回答
0
投票
usr

图形参数控制。

有关详细信息,请参阅
plt

help(par)

您可以通过调用
(...)
‘plt’ A vector of the formc(x1, x2, y1, y2)’ giving the
      coordinates of the plot region as fractions of the current
      figure region.
(...)
‘usr’ A vector of the formc(x1, x2, y1, y2)’ giving the extremes
      of the user coordinates of the plotting region.  When a
      logarithmic scale is in use (i.e., ‘par("xlog")’ is true, see
      below), then the x-limits will be ‘10 ^ par("usr")[1:2]’.
      Similarly for the y-axis.
(...)
(或者,如果您只想查看特定参数,
par()

.

在您的情况下,您似乎想绘制插图中矩形(
par(c("plt","usr"))
)给出的范围,因此您需要使用这些值来定义

xleft = 107, ybottom = 0, xright = 122, ytop = 21

。关于画布区域,您可能需要进行一些实验。

usr
对我来说很好,但我猜这可能取决于各种设置,并且可能对您有所不同。
在任何情况下,尝试这样的事情:
c(0.76, 0.935, 0.195, 0.45)

您可能会使用此代码:

安装和负载所需的软件包

0
投票

绘制中国地图

映射(“世界”,区域=“中国”,fill = true,col =“ lightblue”,bg =“ white”)

南中国海

-polygon(C(110、125、125、110),C(10、10、20、20),col =“ blue”,border =“ blue”)

addtitle

title(主要=“与南中国海的中国地图”)

任何人都需要业务,然后转到:

https://www.dragonsourcing.com/china-sourcing-service/

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.