-
Notifications
You must be signed in to change notification settings - Fork 220
/
eda_stars.Rmd
52 lines (41 loc) · 991 Bytes
/
eda_stars.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 地理数据处理 {#eda-stars}
```{r, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
warning = FALSE,
message = FALSE,
fig.showtext = TRUE
)
```
```{r stars-1, message = FALSE, warning = FALSE}
library(tidyverse)
library(sf)
library(stars)
library("rnaturalearth")
library("rnaturalearthdata")
```
获取世界地图数据
```{r}
world_map_data <- ne_countries(scale = "medium", returnclass = "sf")
ggplot(data = world_map_data) +
geom_sf()
```
使用不同的坐标系统
```{r}
ggplot(data = world_map_data) +
geom_sf() +
coord_sf(crs = st_crs(3035))
```
上色
```{r}
ggplot(data = world_map_data) +
geom_sf(color = "black", fill = "lightgreen")
```
```{r}
ggplot(data = world_map_data) +
geom_sf(aes(fill = pop_est)) +
scale_fill_viridis_c(option = "plasma", trans = "sqrt")
```
```{r stars-2, echo = F, message = F, warning = F, results = "hide"}
pacman::p_unload(pacman::p_loaded(), character.only = TRUE)
```