View source: R/tm_layers_aux.R
tm_graticules | R Documentation |
Draw latitude and longitude graticules. It creates a tmap-element
that draws coordinate grid lines. It serves as a
layer that can be drawn anywhere between other layers. See tm_grid()
for
drawing horizontal lines.
tm_graticules(
x = NA,
y = NA,
n.x = NA,
n.y = NA,
crs = 4326,
labels.format = list(suffix = intToUtf8(176)),
labels.cardinal = TRUE,
...
)
x |
X coordinates for vertical grid lines. If |
y |
Y coordinates for horizontal grid lines. If |
n.x |
Preferred number of grid lines for the x axis. For the labels,
a |
n.y |
Preferred number of grid lines for the y axis. For the labels, a
|
crs |
Projection character. If specified, the grid lines are projected accordingly. Many world maps are projected, but still have latitude longitude (EPSG 4326) grid lines. |
labels.format |
List of formatting options for the grid labels. Parameters are:
|
labels.cardinal |
Add the four cardinal directions (N, E, S, W) to the labels, instead of using negative coordinates for west and south (so it assumes that the coordinates are positive in the north-east direction). |
... |
Arguments passed on to
|
current.mode <- tmap_mode("plot")
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid()
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid(crs = 4326)
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid(crs = 3035, labels.inside.frame = TRUE)
tm_shape(World) +
tm_polygons() +
tm_facets(by = "continent") +
tm_grid(labels.inside.frame = TRUE)
tm_shape(NLD_muni) +
tm_polygons() +
tm_graticules()
tm_shape(NLD_muni) +
tm_polygons() +
tm_graticules(labels.pos = c("right", "top"))
data(NLD_muni, World)
tmap_arrange(
qtm(NLD_muni, borders = NULL) + tm_grid(),
qtm(NLD_muni, borders = NULL) + tm_graticules()
)
qtm(World, shape.crs = "+proj=robin", style = "natural") +
tm_graticules(ticks = FALSE) +
tm_layout(frame=FALSE)
tmap_mode(current.mode)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.