guide-axis-logticks

Add minor tick marks at log-scale subdivisions on a transform: "log10" axis.

Inherits the angle / n-dodge controls from guide-axis and additionally emits short, unlabelled tick marks at the sub-decade positions (2, 3, …, 9 within each decade). Has no effect when the axis is not log10-transformed.

Usage

guide-axis-logticks(
  angle: 0,
  n-dodge: 1,
)

Parameters

Parameter Default Description
angle 0 Tick-label rotation in degrees.
n-dodge 1 Number of rows/columns across which to stagger labels.

Returns

Guide dictionary tagged kind: "guide", consumed by guides.

Examples

Major ticks at decade boundaries plus minor ticks at 2, 3, …, 9.

#let d = (
  (x: 1, y: 1),
  (x: 10, y: 100),
  (x: 100, y: 10000),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-point(size: 3pt),),
  scales: (
    scale-x-continuous(transform: "log10"),
    scale-y-continuous(transform: "log10"),
  ),
  guides: guides(
    x: guide-axis-logticks(),
    y: guide-axis-logticks(),
  ),
  width: 10cm,
  height: 6cm,
)

Scatter chart on log10 x and y axes showing labelled decade ticks plus shorter unlabelled ticks at sub-decade positions.

Scatter chart on log10 x and y axes showing labelled decade ticks plus shorter unlabelled ticks at sub-decade positions.

See also

guide-axis, guides.

Back to top