breaks-extended

Round breaks from the extended Wilkinson search.

Since 0.6.0.

Scores candidate sequences on simplicity, coverage of the data, and how close the tick count lands to n, which is what the automatic breaks already do; call it to ask for a different n. The counterpart of scales::breaks_extended().

Usage

breaks-extended(
  n: 5,
)

Parameters

Parameter Default Description
n 5 Target number of ticks; the search trades it off against the other criteria, so the result may hold one or two more or fewer.

Returns

Closure taking the trained values and returning break positions.

Examples

Eight ticks where the default asks for five.

#plot(
  data: mpg,
  mapping: aes(x: "displ", y: "hwy"),
  layers: (geom-point(),),
  scales: scales(y: scale-continuous(breaks: breaks-extended(n: 8))),
  width: 10cm,
  height: 6cm,
)

Scatter chart of engine displacement against highway mileage with about eight y axis ticks.

Scatter chart of engine displacement against highway mileage with about eight y axis ticks.

See also

breaks-pretty, breaks-width, scale-continuous.

Back to top