scatter
lq.scatter(x, y, size=auto, color=auto, map=color.map.viridis, min=auto, max=auto, norm="linear", mark=auto, stroke=1pt, alpha=100%, label=none, clip=true, z-index=2)
Produces a scatter plot from the given coordinates. The mark size and
color can be set per point (this discerns scatter
from plot
).
#import "@preview/suiji:0.3.0"
#let rng = suiji.gen-rng(33)
#let (rng, x) = suiji.uniform(rng, size: 20)
#let (rng, y) = suiji.uniform(rng, size: 20)
#let (rng, colors) = suiji.uniform(rng, size: 20)
#let (rng, sizes) = suiji.uniform(rng, size: 20)
#lq.diagram(
lq.scatter(
x, y,
size: sizes.map(size => 200 * size),
color: colors,
map: color.map.magma
)
)
x : array
An array of coordinates.
y : array
An array of coordinates. The number of and coordinates must match.
size : auto
| array
default: auto
Mark sizes as float
values. The area of the marks will scale proportionally
with these numbers while the actual mark size (width) will scale with
.
color : auto
| color
| array
default: auto
Mark colors. The element may either be of type color
(then the argument
scatter.map
will be ignored) or of type float
. In the case of the
latter, the colors will be determined by normalizing the values and passing
them through the map
.
map : array
| gradient
default: color.map.viridis
A color map in form of a gradient or an array of colors to sample from when
scatter.color
is given as float
values.
min : auto
| int
| float
default: auto
Sets the data value that corresponds to the first color of the color map. If set
to auto
, it defaults to the minimum value of scatter.color
.
max : auto
| int
| float
default: auto
Sets the data value that corresponds to the last color of the color map. If set
to auto
, it defaults to the maximum value of scatter.color
.
norm : lq.scale
| str
| function
default: "linear"
The normalization method used to scale coordinates to the range
before mapping them to colors using the color map. This can be a
scale
, a string that is the identifier of a built-in scale or a function
that takes one argument (for example the argument x => calc.log(x)
would be equivalent to passing "log"
). Note that the function does not
actually need to map the values to the interval . Instead it
describes a scaling that is applied before the data set is linearly
scaled to the interval .
mark : auto
| lq.mark
| string
default: auto
The mark to use to mark data points. See plot.mark
.
stroke : stroke
default: 1pt
Mark stroke. TODO: need to get rid of it
alpha : ratio
| array
default: 100%
The fill opacity. TODO: maybe get rid of it, there is already color.
label : content
default: none
The legend label for this plot. See plot.label
.
clip : bool
default: true
Whether to clip the plot to the data area. See plot.clip
.
z-index : int
| float
default: 2
Determines the position of this plot in the order of rendered diagram
objects. See plot.z-index
.