axslash: Drawer of axis double slash

View source: R/axslash.R

axslashR Documentation

Drawer of axis double slash

Description

Draws a double slash to the axis to indicate a gap in graph range.

Usage

axslash(
  at,
  tick = 0.5,
  sep = 0.5,
  deg = 90,
  fg = "black",
  bg = "white",
  side = 1,
  ...
)

Arguments

at

Numerics. The positions to put slashes in the graph. The values are in the same metrics (scale) to the designated axis. The points become the center of each double slash.

tick

A numeric. The height of slashes as a fraction of the default character height. Note that the default height of the ticks in plotting is a half (0.5) of the character height.

sep

A numeric. The width between slashes as a fraction of the default character width.

deg

A numeric. The angle of the slashes in relation to the direction of the axis. This must be a non-zero value since 0 degree to the axis direction results in a complete parallel lines to (and on) the axis. Setting 90 results in a equal-like mark perpendicular to the axis instead of slashes.

fg

A string. The color of the slash lines.

bg

A string. The color of the space intervened between the slashes. This color overwrite the existing axis. Therefore, the same color to the graph's background should be naturally used.

side

An integer. The side of the axis to put slashes in the same way to other R's default plotting functionality (1:bottom, 2:left, 3:top, 4:right).

...

Other arguments passed to graphics::lines().

Details

When creating a graph, there are times that you want to put a gap in the graph's axis so that you can show numerically distant data points in neighbor (of course for the visualization purpose). This function provides an easy way for it, with arbitrary height, spacing and angles of the two slashes.

Examples

x <- seq(-3, 3)
z <- 10
y <- pnorm(x)
plot(x, y, type = "o", bty = "l",
  xlim = c(min(x), max(x) + 1), xaxt = "n")
points(max(x) + 1, pnorm(z))
axis(1, at = c(x, max(x) + 1), labels = c(x, z))
axslash(max(x) + 0.5, deg = 60)


keimochizuki/htb documentation built on June 9, 2025, 10:03 p.m.