axis
lq.axis(scale=auto, lim=auto, inverted=false, label=none, kind="x", position=auto, mirror=auto, ticks=auto, subticks=auto, tick-distance=auto, offset=auto, exponent=auto, auto-exponent-threshold=3, locate-ticks=auto, format-ticks=auto, locate-subticks=auto, format-subticks=none, extra-ticks=(), format-extra-ticks=none, tick-args=(:), subtick-args=(:), functions=auto, hidden=false, stroke=auto, tip=auto, toe=auto, filter=(value, distance) => true, ..plots)(source)An axis for a diagram. Visually, an axis consists of a spine along the axis direction, a collection of ticks/subticks and an axis label.
By default, a diagram features two axes: an x and a y axis which can be
configured directly through diagram.xaxis and diagram.yaxis. However, it is
also possible to add more axes, please refer to the
axis tutorial for more details.
The built-in tick formatters use the Typst package Zero for displaying numbers. This makes it possible to define a consistent number format throughout the entire document, including tables, in-text quantities, and figures.
scale : auto | str | lq.scale default: auto
Sets the scale of the axis. This may be a scale object or the name of
one of the built-in scales "linear", "log", "symlog", and
"datetime".
If left at auto, the scale will be set to "datetime" if any of the
plots uses datetime coordinates and "linear" otherwise.
lim : auto | array default: auto
Data limits of the axis. This can be used to fix the minimum and/or maximum value
displayed along this axis. This parameter expects auto or a tuple (min, max)
where min and max can also be auto. If a limit is auto, it will be
automatically computed from all plots associated with this axis and diagram.margin
will be applied. If the minimum is larger than the maximum, the scale is inverted
and if min and max coincide, the range will be automatically increased.
Also see axis.inverted.
inverted : bool default: false
Whether to invert the limits (swap minimum and maximum). Inverting is applied regardless of whether the limits are set manually or computed automatically.
label : content | lq.label default: none
Label for the axis. Use a label object for more options.
kind : "x" | "y" default: "x"
The kind of the axis.
position : auto | alignment | float | relative | dictionary default: auto
Where to place this axis. This can be
- one of the sides of the diagram (
toporbottomfor -axes,leftorrightfor -axes), - a
floatcoordinate value on the other axis, - a
lengthorrelative, - or a combination of the first and third option through a dictionary
with the keys
alignandoffset.
More on axis placement can be found in the axis tutorial.
mirror : auto | bool | dictionary default: auto
Whether to mirror the axis, i.e., whether to show the axis ticks also on
the side opposite of the one specified with axis.position. When set to
auto, mirroring is only activated when position: auto. More control
is granted through a dictionary with the possible keys ticks and
tick-labels to individually activate or deactivate those.
More on axis mirrors can be found in the axis tutorial.
ticks : auto | array | dictionary | none default: auto
Instead of using the tick locator, specifies the tick locations explicitly
and optionally the tick labels. This can be an array with just the tick
location or tuples of tick location and label, or a dictionary with the
keys ticks and labels, containing arrays of equal length. When ticks
is none, no ticks are displayed. If it is auto, the tick-locator is
used.
Check out the tutorial on ticks for tips on how to work with ticks.
subticks : auto | none | int default: auto
Instead of using the tick locator, specifies the tick positions explicitly and optionally the tick labels.
Also see the tutorial on ticks.
tick-distance : auto | float default: auto
Passes the parameter tick-distance to the tick locator. The linear tick
locator respects this setting and sets the distance between consecutive
ticks accordingly. If tick-args already contains an entry tick-distance,
it takes precedence.
offset : auto | int | float | content | none default: auto
Offset for all ticks on this axis. The offset is subtracted from all ticks and shown at the end of the axis (if it is not 0). An offset can be used to avoid overly long tick labels and to focus on the relative distance between data points.
If none or a value of type content, the offset is just displayed and
has no effect on how the data is presented.
exponent : auto | none | int | "inline" default: auto
Exponent for all ticks on this axis. All ticks are divided by and the is shown at the end of the axis (if the exponent is not 0). This setting can be used to avoid overly long tick labels.
In combination with logarithmic tick locators, none can be used to
force writing out all numbers.
auto-exponent-threshold : int default: 3
Threshold for automatic exponents.
locate-ticks : auto | function default: auto
The tick locator for the regular ticks. Also see locating ticks.
format-ticks : auto | function default: auto
The formatter for the (major) ticks. Also see formatting ticks.
locate-subticks : auto | function default: auto
The tick locator for the subticks. Also see locating ticks.
format-subticks : auto | none | function default: none
The formatter for the subticks. Also see displaying subticks.
extra-ticks : array default: ()
An array of extra ticks to display. The ticks can be positions given as float data values or tick instances.
format-extra-ticks default: none
The formatter for the extra ticks.
tick-args : dictionary default: (:)
Arguments to pass to the tick locator.
subtick-args : dictionary default: (:)
Arguments to pass to the subtick locator.
functions : auto | array default: auto
Specifies conversions between the data and the ticks. This can be used to
configure a secondary axis to display the same data in a different unit,
e.g., the main axis displays the velocity of a particle while the
secondary axis displays the associated energy. In this case, one would
pick functions: (x => m*x*x, y => calc.sqrt(y/m)) with some constant
m. Note that the first function computes the "forward" direction while
the second function computes the "backward" direction. The user needs to
ensure that the two functions are really inverses of each other.
By default, this parameter resolves to the identity.
hidden : bool default: false
If set to true, the entire axis is hidden.
stroke : auto | stroke default: auto
How to stroke the spine of the axis. If not auto, this is forwarded to
spine.stroke.
tip : auto | none | tiptoe.mark default: auto
Places an arrow tip on the axis spine. This expects a mark as specified by
the tiptoe package.
If not auto, this is forwarded to spine.tip.
toe : auto | none | tiptoe.mark default: auto
Places an arrow tail on the axis spine. This expects a mark as specified by
the tiptoe package.
If not auto, this is forwarded to spine.toe.
filter default: (value, distance) => true
..plots : any
Plot objects to associate with this axis. This only applies when this is a secondary axis. Automatic limits are then computed according to this axis and transformations of the data coordinates linked to the scaling of this axis.