-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapping_demo.R
67 lines (49 loc) · 1.25 KB
/
mapping_demo.R
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library(spData)
library(mapview)
# Mapview vector data
world
names(world)
mapview(world, zcol = "pop")
# Mapview
# Get t2m data from
# https://tinyurl.com/yycn5zse
t2m <- raster::brick("data/era5_t2m.tif")
t2m
mapview(t2m$era5_t2m.1)
p <- mapview(world)
mapview(t2m$era5_t2m.1, map = p)
library(rasterVis)
par(mar = c(1, 1, 1, 1))
rasterVis::levelplot(t2m)
rasterVis::levelplot(t2m, layers = 1)
library(tmap)
data("World")
tm_shape(world) +
tm_polygons("pop")
tmap_mode("view")
tm_shape(World) +
tm_polygons("HPI")
data(World, metro, rivers, land)
tmap_mode("plot")
## tmap mode set to plotting
tm_shape(land) +
tm_raster("elevation", palette = terrain.colors(10)) +
tm_shape(World) +
tm_borders("white", lwd = .5) +
tm_text("iso_a3", size = "AREA") +
tm_shape(metro) +
tm_symbols(col = "red", size = "pop2020", scale = .5) +
tm_legend(show = FALSE)
tmap_mode("view")
tm_shape(land) +
tm_raster("elevation", palette = terrain.colors(10)) +
tm_shape(World) +
tm_borders("white", lwd = .5) +
tm_text("iso_a3", size = "AREA") +
tm_shape(metro) +
tm_symbols(col = "red", size = "pop2020", scale = .5) +
tm_legend(show = FALSE)
tmap_mode("view")
tm_shape(World) +
tm_polygons(c("HPI", "economy")) +
tm_facets(sync = TRUE, ncol = 2)