Ai
1 Star 0 Fork 3

weijiew/R-graph-gallery

forked from 程序员维C社区/graph 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
278-the-maps-library.Rmd 3.43 KB
一键复制 编辑 原始数据 按行查看 历史
holtzy 提交于 2019-05-08 16:15 +08:00 . small
title descriptionMeta descriptionTop sectionText sectionLink DataToVizText DataToVizLink url output
The `Maps`, `Mapdata` and `Oz` packages to get most common boundaries
The maps, mapdata and oz packages provide the boundaries of the most common world regions like the US, Europe, New Zealand and more. This post describes how to use them to avoid struggling finding input data.
The [maps](#maps), [mapdata](#mapdata) and [oz](#oz) packages provide the boundaries of the most common world regions like the US, Europe, New Zealand and more. This post describes how to use them to avoid struggling finding input data.
Background map section
map.html
About Maps
data-to-viz.com/graph/map.html
278-the-maps-library
html_document
self_contained mathjax lib_dir template css toc toc_float toc_depth df_print
false
default
libs
template_rgg.html
style.css
true
true
2
paged
```{r global options, include = FALSE} knitr::opts_chunk$set( warning=FALSE, message=FALSE) ```
# `maps` package {#maps} ***
The [maps](https://cran.r-project.org/web/packages/maps/maps.pdf) package is the best source of geospatial data in R. The whole list of offered data is available typing: `help(package='maps')`. It includes: - World: `world`, `world.cities`, `lakes` - US: states, `county`, `state`, `usa` - France: `france` - Italy: `italy` - New zealand: `nz` The code below shows how to use one of this geospatial object.
```{r thecode, echo=FALSE, out.width = "100%", fig.height=4} # Load library library(maps) # Check all available geospatial objects: # help(package='maps') # Map of the world: map('world',col="grey", fill=TRUE, bg="white", lwd=0.05, mar=rep(0,4),border=0, ylim=c(-80,80) ) ```
```{r thecode, eval=FALSE} ``` # `mapdata` package {#mapdata} ***
The [mapdata](https://cran.r-project.org/web/packages/mapdata/mapdata.pdf) package extends the `maps` package with more geospatial datasets: - `china` - `japan` - Other world versions like pacific Centric (`world2Hires`) See complete list with `help(package='mapdata')`
```{r thecode2, echo=FALSE, out.width = "100%", fig.height=4} # Load library library(mapdata) # Check all available geospatial objects: # help(package='mapdata') # Map of Japan: map('japan',col="black", lwd=1, mar=rep(0,4) ) ```
```{r thecode2, eval=FALSE} ``` # `oz` package {#oz} ***
The [oz](https://github.com/cran/oz) package provides several geospatial object concerning Australia. Plot the general country using the `oz()` function, or states using `nsw()`, `qld()` and so on.. Type `help(package='oz')` for documentation.
```{r thecode3, echo=FALSE, out.width = "100%", fig.height=4} # Load library library(oz) # Check all available geospatial objects: # help(package='oz') # Map of Australia par(mar=rep(0,4)) oz( states=TRUE, col="#69b3a2") ```
```{r thecode3, eval=FALSE} ```
```{r, echo=FALSE} htmltools::includeHTML("htmlChunkRelatedMap.html") ```
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/weijiew/R-graph-gallery.git
git@gitee.com:weijiew/R-graph-gallery.git
weijiew
R-graph-gallery
R-graph-gallery
master

搜索帮助