From 95e0a668602d690f2639adf2892bc0e827d9ba1f Mon Sep 17 00:00:00 2001 From: Liang Ren <932196440@qq.com> Date: Mon, 25 Nov 2024 01:19:09 +0800 Subject: [PATCH] 0.0.2 --- docs/articles/Adding_Basic_Map.html | 89 +++++++++- .../{example5-1.png => example2-1.png} | Bin .../figure-html/example3-1.png | Bin 0 -> 272392 bytes .../figure-html/example4-1.png | Bin 0 -> 203450 bytes docs/articles/Adding_Spatial_Data.html | 25 ++- .../figure-html/clip region-1.png | Bin 0 -> 255718 bytes docs/index.html | 50 ++---- docs/pkgdown.yml | 2 +- docs/reference/coord_proj-1.png | Bin 0 -> 209088 bytes docs/reference/coord_proj-2.png | Bin 0 -> 323898 bytes docs/reference/coord_proj.html | 156 ++++++++++++++++++ docs/reference/figures/README-example1-1.png | Bin 0 -> 10600 bytes docs/reference/figures/README-example2-1.png | Bin 10412 -> 10652 bytes docs/reference/figures/README-example3-1.png | Bin 10652 -> 11652 bytes docs/reference/figures/README-example4-1.png | Bin 11825 -> 11607 bytes docs/reference/geom_mapcn-4.png | Bin 107180 -> 0 bytes docs/reference/index.html | 6 + docs/search.json | 2 +- docs/sitemap.xml | 1 + vignettes/Adding_Basic_Map.Rmd | 2 +- 20 files changed, 292 insertions(+), 41 deletions(-) rename docs/articles/Adding_Basic_Map_files/figure-html/{example5-1.png => example2-1.png} (100%) create mode 100644 docs/articles/Adding_Basic_Map_files/figure-html/example3-1.png create mode 100644 docs/articles/Adding_Basic_Map_files/figure-html/example4-1.png create mode 100644 docs/articles/Adding_Spatial_Data_files/figure-html/clip region-1.png create mode 100644 docs/reference/coord_proj-1.png create mode 100644 docs/reference/coord_proj-2.png create mode 100644 docs/reference/coord_proj.html create mode 100644 docs/reference/figures/README-example1-1.png delete mode 100644 docs/reference/geom_mapcn-4.png diff --git a/docs/articles/Adding_Basic_Map.html b/docs/articles/Adding_Basic_Map.html index 6badca2..883c9f4 100644 --- a/docs/articles/Adding_Basic_Map.html +++ b/docs/articles/Adding_Basic_Map.html @@ -65,10 +65,19 @@
The ggmapcn package provides various tools for visualizing geographic
+data in China and beyond. This vignette demonstrates the basic and
+advanced usage of geom_mapcn()
and
+geom_world()
for plotting administrative boundaries and
+combining geographic data.
To plot a map of China with province boundaries, use the
geom_mapcn()
function. The map uses the Azimuthal Equal
@@ -80,7 +89,7 @@
Here’s a comprehensive example demonstrating how to plot province boundaries, buffer zones, and coastlines on the same map:
@@ -91,7 +100,79 @@The geom_world()
function allows you to visualize global
+data, while geom_mapcn()
overlays China for detailed
+analysis.
+# Define projections
+china_proj <- "+proj=aeqd +lat_0=35 +lon_0=105 +ellps=WGS84 +units=m +no_defs"
+
+# Combine world map as a background and China map as overlay
+ggplot() +
+ # World map as background
+ geom_world(fill = "gray90", color = "gray70", linewidth = 0.2) +
+ coord_proj(
+ crs = "+proj=merc",
+ xlim = c(-180, 180),
+ ylim = c(-90, 90)
+ ) +
+ # Overlay China map
+ geom_mapcn(
+ fill = "lightblue",
+ color = "black",
+ linewidth = 0.5
+ ) +
+ geom_boundary_cn(color = "red", linewidth = 0.6) +
+ theme_minimal()
+#> Linking to GEOS 3.11.2, GDAL 3.8.2, PROJ 9.3.1; sf_use_s2() is TRUE
+#> Coordinate system already present. Adding new coordinate system, which will
+#> replace the existing one.
+#> Warning: Duplicated aesthetics after name standardisation: colour and linewidth
+#> Duplicated aesthetics after name standardisation: colour and linewidth
+#> Duplicated aesthetics after name standardisation: colour and linewidth
+#> Duplicated aesthetics after name standardisation: colour and linewidth
+#> Duplicated aesthetics after name standardisation: colour and linewidth
This example demonstrates filtering for China and its neighboring +countries, highlighting China in red.
+
+# Define neighboring countries
+china_neighbors <- c("CHN", "AFG", "BTN", "MMR", "LAO", "NPL", "PRK", "KOR",
+ "KAZ", "KGZ", "MNG", "IND", "BGD", "TJK", "PAK", "LKA", "VNM")
+
+# Plot world map with filtered countries
+ggplot() +
+ geom_world(fill = "gray90", color = "gray70", linewidth = 0.2) +
+ geom_world(
+ filter = china_neighbors,
+ filter_attribute = "SOC",
+ fill = "lightblue",
+ color = "black",
+ linewidth = 0.5
+ ) +
+ geom_world(
+ filter = "CHN",
+ filter_attribute = "SOC",
+ fill = "red",
+ color = "black",
+ linewidth = 0.8
+ ) +
+ coord_proj(
+ crs = "+proj=merc",
+ xlim = c(60, 140),
+ ylim = c(-10, 60)
+ ) +
+ theme_minimal()
%GW>8qout?O5aT7U59m4X
zswOM%#-)_DCSJ9-6#B4>oMuMA4_rvTp;)jr1~XBr#w|GX{^93%V+X>*9xp73UP2ni
z*-=IE^YZF>)mF24KmFCneeGE-jtU%^pP#q#nUG9rb4FU+7eChEH5Ml?FkEJ*>CXN0
zG@M5>mG!QKfn|ynn^bH>x2YWRY%A&N>f%6MOmE|08xOG8t=NU6E{Ch4Q=dAV16OAB
za7ZsUc9Afy)F2p~Y5q1spJ+ DXl=cnZS
zbH>$(>n{Uh==HBRm7mDp#-8
z-op)?i)F9>bF4alQz08tFp^N>#{2f~57~s%sU&Oxbny>^;&V$kWhskRcfMfQjlx21
ze*8P$#{Q!~b1=q+I1)`GS4Pg>S^pQjqkD`kEv3)Qhgh~5I#hTnYJyT-Ore|B1rQ~w
ze;pXFft#4!n62#!-IE&d1)7xLMtBF2Fb@zmYRfu3={jv|Yl}49x^X