Skip to main content

linear

lq.tick-locate.linear(x0, x1, tick-distance=auto, num-ticks-suggestion=5, max-ticks=200, density=100%, unit=1.0, ..args)(source)

Locates linear ticks on an axis with range [x0,x1][x_0, x_1]. The range may be inverted, i.e., x0>x1x_0 > x_1 but not x0=x1x_0 = x_1.

This function returns a dictionary with the keys

  • ticks, containing an array of tick positions,
  • exponent, holding an automatic exponent nn so that the range [tmin/10n,tmax/10n][t_\mathrm{min}/10^n, t_\mathrm{max}/10^n] spans at most 10 for min/max ticks tmin,tmaxt_\mathrm{min}, t_\mathrm{max}. This exponent may be applied by the axis to improve legibility of the ticks and to reduce their length when printed.
  • offset, containing some offset that may be used by the axis to reduce the length of tick labels by subtracting it from all ticks.
  • significant-digits: The maximum number of significant digits of the returned ticks. This is an optimization for label formatting because this function has the information for free while a formatter needs to expensively estimate it.
Parameters

x0 : float

The start of the range to locate ticks for.

x1 : float

The end of the range to locate ticks for.

tick-distance : auto | float | dictionary    default: auto

Sets the distance between consecutive ticks manually. If set to auto, the distance will be determined automatically according to num-ticks-suggestion, density, and the given range.

The automatic distance can be constrained by passing a dictionary with the possible keys "min" and "max". For example, by using tick-distance: (min: 1), you can ensure that the tick distance is never less than 1 while still being automatically chosen for large ranges.

num-ticks-suggestion : int | float    default: 5

Suggested number of ticks to use. This may for example be chosen according to the length of the axis and the font size.

max-ticks : int    default: 200

The maximum number of ticks to generate. This guard prevents an accidental generation of a huge number of ticks.

density : ratio    default: 100%

The density of ticks. This can be used as a qualitative knob to tune the number of generated ticks in relation to the suggested number of ticks.

unit : float    default: 1.0

A unit relative to which the tick distance is taken. This can for example be used to generate ticks based on multiples of π\pi while keeping the flexibility of an automatically determined tick distance.

..args : any

Ignored arguments that do not apply to this locator.