View source: R/addCoordsAxes.R
addCoordsAxes | R Documentation |
Add labels for XY axis on a map
addCoordsAxes(
xParams = NULL,
yParams = NULL,
where = c(1, 2),
las = 1,
labels = NULL,
dms = "d",
...
)
xParams |
Parameters for X axis. |
yParams |
Parameters for Y axis. |
where |
|
las |
|
labels |
|
dms |
A |
... |
Extra arguments passed to axis function (e.g. |
xParams
and yParams
must contain axis information as a 3 or 4 length vector.
"length 3:"to indicate from 100 S to 70 S by 5, the vector will be c(-100, -70, 5).
"length 4:"to indicate from 100 S to 70 S by 5 and draw a second set of ticks from 100 S to 70 S by 1, the vector will be c(-100, -70, 1, 5).
If labels
is specified at ...
, the function will consider this values for both xParams
and
yParams
, so be carefull and use it separately (run the function twice for lon and lat).
par(mar = c(2, 3, 1, 3), xaxs = "i", yaxs = "i")
xlim <- c(-85, -70)
ylim <- c(-20, -2)
plot(1, 1, type = "n", axes = FALSE, xlab = NA, ylab = NA, xlim = xlim, ylim = ylim)
addCoordsAxes(xParams = c(xlim, 5), yParams = c(ylim, 2), where = c(1, 2, 4))
box()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.