axis_text: Add labels to the axis labels

View source: R/axis_text.R

axis_textR Documentation

Add labels to the axis labels

Description

A wrapper function for mtext with two changes.

1. The default for text and at is now NULL. If both are NULL, axTicks will be used to determine what values to include on the x (side = 1) or y (side = 2) axis. 2. If length(text) == 1 and at = NULL, then the appropriate side will find the central point of the axis to put the text (e.g., for an axis title).

Usage

axis_text(
  text = NULL,
  labels = FALSE,
  side = 3,
  line = 0,
  outer = FALSE,
  at = NULL,
  adj = NA,
  padj = NA,
  cex = NA,
  col = NA,
  font = NA,
  ...
)

Arguments

text

a character or expression vector specifying the text to be written. See mtext.

labels

Set to FALSE. See axis.

side

an integer specifying which side of the plot the axis is to be drawn on. The axis is placed as follows: 1=below, 2=left, 3=above and 4=right.

line

on which MARgin line, starting at 0 counting outwards.

outer

use outer margins if available.

at

The location of each string in user coordinates (i.e., the text). See mtext.

adj

adjustment for each string in reading direction. For strings parallel to the axes, adj = 0 means left or bottom alignment, and adj = 1 means right or top alignment. See mtext.

padj

adjustment for each string perpendicular to the reading direction (which is controlled by adj). See mtext.

cex

character expansion factor. Can be a vector.

col

color to use. Can be a vector. NA values (the default) means use par("col").

font

font for text. Can be a vector. NA values (the default) means use par("font").

...

Other graphical parameters that may apply to mtext.

Examples

## Not run: 
   blank(
     xlim = c(0,50),
     ylim = c(0,100),
     bty ="l"
   )
   
   axis_blank(1, at = seq(0,50,10))
   axis_text(side = 1)
   axis_blank(2, at = seq(0,100,20))
   axis_text(side = 2)
   

## End(Not run)


dapperstats/bbplot documentation built on June 11, 2022, 8:38 p.m.