draw_land: Draw land masses in orthographic projection

Description Usage Arguments See Also Examples

View source: R/draw_land.R

Description

The function draw_land() draws a set of polygons representing land masses. The function draw_ocean() draws the ocean background and graticules.

Usage

1
2
3
4
5
6
7
draw_land(coord, cenlat = 40, cenlong = 15, xlim = c(-1.2, 1.2),
  ylim = c(-1.2, 1.2), col = "#E69F00B0", bg_col = "white",
  line_col = "black", lwd = 0.5)

draw_ocean(cenlat = 40, cenlong = 15, xlim = c(-1.2, 1.2),
  ylim = c(-1.2, 1.2), col = "#56B4E950", line_col = "grey30",
  lwd = 0.5)

Arguments

coord

Dataframe holding polygon coordinates in columns x and y, representing longitude and latitude. Polygons are separated by rows of NA.

cenlat

Center latitude of projected earth.

cenlong

Center longitude of projected earth.

xlim, ylim

Limits of the enclosing plot. The actual earth is projected from -1 to 1 in x and y.

col

Land or ocean color.

bg_col

Background color.

line_col

Line color.

lwd

Line width.

See Also

map_polys

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# static plot
world <- map_polys$world
cenlat <- 45
cenlong <- 0
draw_ocean(cenlat, cenlong)
draw_land(world, cenlat, cenlong)

## Not run: 
# animation
makeplot <- function() {
  cenlat <- 35
  by <- 2
  longs <- seq(-180, 180-by, by = by)
  for (cenlong in longs) {
    draw_ocean(cenlat, cenlong)
    draw_land(map_polys$usa, cenlat, cenlong, col = "#FF0000B0") 
    draw_land(map_polys$world_no_usa, cenlat, cenlong, col = "#C0C0C0B0")
  }
}
gifski::save_gif(makeplot(), "world.gif", delay = 1/24, 500, 500)

## End(Not run)

clauswilke/dviz.supp documentation built on Aug. 25, 2020, 2:12 a.m.