addCoordsAxes: Add labels for XY axis on a map

View source: R/addCoordsAxes.R

addCoordsAxesR Documentation

Add labels for XY axis on a map

Description

Add labels for XY axis on a map

Usage

addCoordsAxes(
  xParams = NULL,
  yParams = NULL,
  where = c(1, 2),
  las = 1,
  labels = NULL,
  dms = "d",
  ...
)

Arguments

xParams

Parameters for X axis.

yParams

Parameters for Y axis.

where

character vector indicating where to show the labels for axis: 1 (bottom), 2 (left), 3 (top) or 4 (right).

las

numeric in 0,1,2,3; the style of axis labels. See par.

labels

character vector setting the labels for axis.

dms

A character strings indicating what to show (d: degrees, m: minutes, s: seconds).

...

Extra arguments passed to axis function (e.g. cex.axis), which is used internaly for ploting.

Details

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).

Examples

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

LuisLauM/ruisu documentation built on March 26, 2024, 8:23 a.m.