Compute a statistical transform for a draft-layer.
Compute a statistical transform for a draft-layer.
(fit-lm xs-col ys-col)Fit a linear model, return {:x1 :y1 :x2 :y2}.
Fit a linear model, return {:x1 :y1 :x2 :y2}.
(fit-lm-with-se xs-col ys-col n-grid level)Fit a linear model and compute confidence band on a grid of x-values. Returns {:xs [...] :ys [...] :ymins [...] :ymaxs [...] :x1 :y1 :x2 :y2}.
Fit a linear model and compute confidence band on a grid of x-values.
Returns {:xs [...] :ys [...] :ymins [...] :ymaxs [...] :x1 :y1 :x2 :y2}.(fit-loess xs-col ys-col n-grid bandwidth)Fit a LOESS curve, return {:xs ... :ys ...} evaluated on a grid.
Fit a LOESS curve, return {:xs ... :ys ...} evaluated on a grid.
(fit-loess-with-se xs-col ys-col n-grid bandwidth level n-boot)Fit LOESS with bootstrap confidence band. Returns {:xs :ys :ymins :ymaxs} evaluated on a grid.
Fit LOESS with bootstrap confidence band. Returns
{:xs :ys :ymins :ymaxs} evaluated on a grid.(group-by-columns ds group-cols f)Split dataset by grouping columns, apply f to each group.
Iterates groups in the order they first appear in the dataset, so
results are deterministic regardless of tc/group-by's underlying
map type (which is a PersistentHashMap, scrambled by murmur3 hash
for >8 groups). This also preserves user-visible stacking and
draw order.
Split dataset by grouping columns, apply f to each group. Iterates groups in the order they first appear in the dataset, so results are deterministic regardless of `tc/group-by`'s underlying map type (which is a PersistentHashMap, scrambled by murmur3 hash for >8 groups). This also preserves user-visible stacking and draw order.
(numeric-extent col)Min/max pair from a numeric column.
Min/max pair from a numeric column.
(prepare-points draft-layer)Clean data, compute domains, group by columns. Drops rows with missing values in x/y AND in any referenced numeric aesthetic column (color/size/alpha/y-min/y-max/fill) so downstream code never sees nil/NaN values where it tries to coerce to double.
For a :rect mark with both axes numeric (a bar at a numeric or temporal
position), returns a :bar-width in data units and widens the x-domain by
half a bar on each side so edge bars are not clipped.
Clean data, compute domains, group by columns. Drops rows with missing values in x/y AND in any referenced numeric aesthetic column (color/size/alpha/y-min/y-max/fill) so downstream code never sees nil/NaN values where it tries to coerce to double. For a `:rect` mark with both axes numeric (a bar at a numeric or temporal position), returns a `:bar-width` in data units and widens the x-domain by half a bar on each side so edge bars are not clipped.
(written-extent {:keys [mark data x y x-type y-type] :as draft-layer})The data-space extent a rule or a band covers, for the four marks whose extent is written on the layer rather than read from its rows.
Two axes, answered separately. The axis the mark names a value on --
y for :rule-h and :band-h, x for :rule-v and :band-v --
covers what was written, so a rule written outside everything the
data reaches widens the axis until the line is on the panel. The
axis the mark spans covers whatever column the layer's mapping names
there, which is what gives a panel holding nothing but a rule an
axis to draw against; where the mapping names no column, that axis
falls back to [0 1] so the line is still drawable.
Both readings apply to the axis the value is written on: the column
the mapping names there is covered too, so a pose carrying :x and
:y and nothing but a rule draws the axes its mapping describes,
with the rule somewhere on them.
A categorical axis reports the categories its column holds, as
prepare-points does, and takes no written value: a band scale
places a value by which category it is, and a rule's intercept is a
number rather than one of them.
The shape returned is a stat result: :x-domain and :y-domain,
read by plan/collect-domain and plan/compute-global-y-domain the
same way every other mark's is. There are no :points, because
these four marks draw no rows -- extract-layer reads the written
values straight from the draft layer.
The data-space extent a rule or a band covers, for the four marks whose extent is written on the layer rather than read from its rows. Two axes, answered separately. The axis the mark names a value on -- y for `:rule-h` and `:band-h`, x for `:rule-v` and `:band-v` -- covers what was written, so a rule written outside everything the data reaches widens the axis until the line is on the panel. The axis the mark spans covers whatever column the layer's mapping names there, which is what gives a panel holding nothing but a rule an axis to draw against; where the mapping names no column, that axis falls back to `[0 1]` so the line is still drawable. Both readings apply to the axis the value is written on: the column the mapping names there is covered too, so a pose carrying `:x` and `:y` and nothing but a rule draws the axes its mapping describes, with the rule somewhere on them. A categorical axis reports the categories its column holds, as `prepare-points` does, and takes no written value: a band scale places a value by which category it is, and a rule's intercept is a number rather than one of them. The shape returned is a stat result: `:x-domain` and `:y-domain`, read by `plan/collect-domain` and `plan/compute-global-y-domain` the same way every other mark's is. There are no `:points`, because these four marks draw no rows -- `extract-layer` reads the written values straight from the draft layer.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |