addGraticules: Add graticules (parallels and meridians) to a map

Description Usage Arguments Value Author(s) Examples

View source: R/addGraticules.R

Description

This function adds graticules (parallels and meridians) to a map and returns axes labels and coordinates.

Usage

1
2
3
4
5
6
7
8
9
addGraticules(
  prj = "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs",
  parallels = seq(-60, 60, by = 30),
  meridians = seq(-160, 160, by = 40),
  line.color = "#aaaaaa",
  line.size = 0.5,
  line.type = 1,
  add = FALSE
)

Arguments

prj

string the CRS of the map in the PROJ4 standard.

parallels

numeric vector of latitudes to add parallels.

meridians

numeric vector of longitudes to add meridians.

line.color

string color of graticules.

line.size

numeric width of graticules.

line.type

integer type of graticules.

add

boolean If TRUE, graticules are added to the map.

Value

This function returns a 2-elements list.

A first data frame for the meridians with 4 columns:

A second data frame for the parallels with 4 columns:

Author(s)

Nicolas CASAJUS, nicolas.casajus@fondationbiodiversite.com

Examples

 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
library(maps)

maps::map()
addGraticules(
  prj = "+init=epsg:4326",
  add = TRUE
)

## [[1]]
##      x      y label direction
## 1 -160 -90.00   160         W
## 2 -120 -89.95   120         W
## 3  -80 -89.90    80         W
## 4  -40 -89.85    40         W
## 5    0 -89.80     0
## 6   40 -89.75    40         E
## 7   80 -89.70    80         E
## 8  120 -89.65   120         E
## 9  160 -89.60   160         E

## [[2]]
##        x   y label direction
## 1 -180.0 -60    60         S
## 2 -179.9 -30    30         S
## 3 -179.8   0     0
## 4 -179.7  30    30         N
## 5 -179.6  60    60         N

FRBCesab/ecorar documentation built on June 2, 2021, 8:18 p.m.