Description Usage Arguments See Also Examples
The function draw_land()
draws a set of polygons representing land masses.
The function draw_ocean()
draws the ocean background and graticules.
1 2 3 4 5 6 7 |
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. |
map_polys
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.