Skip to main content

colorbar

lq.colorbar(plot, orientation="vertical", thickness=3mm, label=none, ..args)(source)

Creates a color bar using the color information of a colored plot instance like scatter or colormesh.

This generates a new (usually slim) diagram with a filled gradient according to the color map used in the plot, appropriate ticks, and optionally a label. This diagram can be configured through general set rules on diagram and through additional arguments passed through colorbar.args.

#show: lq.set-diagram(height: 3.5cm, width: 4cm)

#let mesh = lq.colormesh(
lq.linspace(-0.3, 1.3),
lq.linspace(-0.3, 1.3),
(x, y) => x * y,
map: gradient.linear(..color.map.icefire).sharp(9)
)

#lq.diagram(
mesh
)
#lq.colorbar(mesh, thickness: 2mm)
Parameters

plot : plot

A plot instance that uses color-coding, e.g., scatter, colormesh, contour, and quiver.

orientation : "vertical" | "horizontal"    default: "vertical"

How to orient the colorbar.

thickness : length    default: 3mm

The thickness of the colorbar.

label : content    default: none

A label to place on the axis.

..args : any

Additional arguments to pass to diagram.