Learn R Programming

terra (version 1.9-11)

add_grid: add a grid to a map made with terra

Description

Adaptation of grid that allows adding a grid to a map. This function will place the grid in the locations within the mapped area as delineated by the axes.

If you set the tick marks yourself, you can use add_abline to create a grid:

Also see graticule

Usage

add_grid(nx=NULL, ny=nx, col="lightgray", lty="dotted", lwd=1)

Arguments

See Also

graticule, add_abline, add_legend, add_box, add_grid, add_mtext

Examples

Run this code
v <- vect(system.file("ex/lux.shp", package="terra"))
plot(v)
add_grid()

Run the code above in your browser using DataLab