Use the coordinates of the input raster to generate coordinate rasters, these are then used in a contour plot.
lonlat(
x,
na.rm = FALSE,
lon = FALSE,
lat = FALSE,
...,
plot = TRUE,
add = TRUE
)
input raster
logical, remove missing values from generated coordinates
if TRUE, only longitude plotted
if TRUE (and `lon = FALSE`) only latitude plotted
passed to [graphics::contour()]
logical, plot the result
logical, add to current plot or instantiate one
RasterBrick of the longitude and latitude values, two layers
(invisibly) the raster (RasterBrick) object with longitude and latitude values of the input as two layers, otherwise this function used for side-effect (drawing on a plot)
Plot is added to an existing plot by default.
plot(c(-180, 180), c(-90, 90))
lonlat(raster::raster())
p <- raster::projectExtent(raster::raster(), "+proj=igh")
lonlat(p, add = FALSE)
lonlat(p, levels = seq(-180, 180, by =15), add = FALSE)
lonlat(p, levels = seq(-180, 180, by = 5), add = FALSE, lon = TRUE)
lonlat(p, levels = seq(-180, 180, by = 15), add = TRUE, lat = TRUE)