FunAxis: Axis Function

View source: R/FunAxis.R

FunAxisR Documentation

Axis Function

Description

Make axis, ticks, lables and axistitle in one step

Usage

FunAxis(
  xtitle = "x axis",
  ytitle = "y axis",
  xline = 2,
  yline = 2,
  xpadj = 0,
  ypadj = 0,
  xcextitle = par("cex"),
  ycextitle = par("cex"),
  xcexlab = par("cex"),
  ycexlab = par("cex"),
  xat = NULL,
  yat = NULL,
  xlabels = TRUE,
  ylabels = TRUE,
  xtick = TRUE,
  ytick = TRUE,
  xtick_lwd = 1.5,
  ytick_lwd = 1.5,
  x_mtext = list(),
  y_mtext = list(),
  x_axis_1 = list(),
  y_axis_1 = list(),
  x_axis_2 = list(),
  y_axis_2 = list(),
  xmt = T,
  ymt = T,
  xmtn = 2,
  ymtn = 2,
  xmtratio = 0.5,
  ymtratio = 0.5,
  xmtbothsides = T,
  ymtbothsides = T,
  xmt_args = list(),
  ymt_args = list(),
  box_lwd = 1.5,
  box_args = list()
)

Arguments

xtitle

x axis title as string

xline

space between x axis title and plotting region in mex

xpadj

space between x axis title and plotting region may be disturbed if you use bquote(). Adapt space with e.g. padj = 0.1, padj = 0 means right or top alignment, and padj = 1 means left or bottom alignment.

xcextitle

x axis title character extension (font size)

xcexlab

x axis labels character extension (font size)

xat

the points at which x axis tick-marks are to be drawn.

xlabels

logical or character vector of labels to be placed at the tickpoints.

xtick

a logical value specifying whether tickmarks and an axis line should be drawn.

xtick_lwd

line width of ticks on the x axis

x_mtext

list of arguments passed to bottom x axis' mtext() e.g. outer, adj, col, font, ...

x_axis_1

list of arguments passed to bottom x axis' axis() e.g. las, pos, outer, font, lty, lwd, lwd.ticks, col, col.ticks, hadj, ...

x_axis_2

list of arguments passed to top x axis' axis()

xmt

logical, should minor ticks on x axis be plotted

xmtn

number of intervals in which to divide the area between major tick marks on the X-axis. Set to 1 to suppress minor tick marks.

xmtratio

ratio of lengths of minor x tick marks to major x tick marks. The length of major tick marks is retrieved from par("tck").

xmtbothsides

should minor ticks be plotted on both x axis (bottom and top)

xmt_args

list of arguments passed to x axis' axis() to plot minor ticks. e.g. lwd, lty, col, ...

box_lwd

line width of box arround the plot

box_args

list of arguments passed to box() to plot box arround plot. e.g. which, lty, ...

y...

each argument for the y axis

Value

axis, ticks, labels and axistitle

Author(s)

Reto Zihlmann

See Also

box, mtext, axis

Examples

# Plot with default settings
plot(1:10, 1:10, ylim = c(-10,20), xlim = c(-5,15),
axes = F, ann = F)                              # always put axes = F, ann = F
FunAxis()

# Plot with arguments passed to FunAxis()
plot(1:10, 1:10, ylim = c(-10,20), xlim = c(-5,15),
axes = F, ann = F)
FunAxis(xtitle = "year", ytitle = "temperature change [°C]")
FunAxis(xcextitle = 2, ycextitle = 2,
xcexlab = 0.5, ycexlab = 0.5, xline = 3)
FunAxis(box_lwd = 3, xtick_lwd = 3, ytick_lwd = 3,
xmtn = 5)

# Pass additional arguments to mtext() or axis()
FunAxis(x_mtext = list(adj = 1), y_mtext = list(adj = 1))  # always put arguments in a list
FunAxis(x_axis_1 = list(las = 2), y_axis_1 = list(las = 0))

retodomax/FunRZ documentation built on Sept. 4, 2024, 9:56 a.m.