Liking cljdoc? Tell your friends :D

scicloj.plotje.impl.plan

Draft-to-plan pipeline: domains, ticks, legends, layout, and grid inference. Takes draft maps (from pose/leaf->draft) and produces a Plan record with all geometry needed for rendering.

Draft-to-plan pipeline: domains, ticks, legends, layout, and grid inference.
Takes draft maps (from pose/leaf->draft) and produces a Plan record
with all geometry needed for rendering.
raw docstring

collect-domainclj

(collect-domain stat-results axis-key scale-spec padding temporal?)

Collect and merge domains from stat results along axis-key. Throws if some stat results contribute numeric domains and others contribute categorical domains -- mixing the two on one axis is ambiguous.

padding is the resolved :domain-padding. temporal? says the axis reads dates, which is what lets :include be written as one.

Collect and merge domains from stat results along axis-key.
Throws if some stat results contribute numeric domains and others
contribute categorical domains -- mixing the two on one axis is
ambiguous.

`padding` is the resolved `:domain-padding`. `temporal?` says the
axis reads dates, which is what lets `:include` be written as one.
sourceraw docstring

compute-global-y-domainclj

(compute-global-y-domain plan-layers scale-spec padding temporal?)

Compute global y-domain from position-adjusted layers. Reads pre-computed :y0/:y1 from stacked layers. Extends domain to include 0 for marks that draw from a zero baseline (bar, area, lollipop) on linear scales. On log scales, baseline extension is skipped -- the lower bound is the smallest positive value the layers report -- because log scales have no zero.

padding is the resolved :domain-padding. temporal? says the axis reads dates, for :include.

Compute global y-domain from position-adjusted layers.
Reads pre-computed :y0/:y1 from stacked layers. Extends domain to
include 0 for marks that draw from a zero baseline (bar, area,
lollipop) on linear scales. On log scales, baseline
extension is skipped -- the lower bound is the smallest positive
value the layers report -- because log scales have no zero.

`padding` is the resolved `:domain-padding`. `temporal?` says the
axis reads dates, for `:include`.
sourceraw docstring

compute-ticksclj

(compute-ticks domain pixel-range scale-spec spacing)
(compute-ticks domain pixel-range scale-spec spacing temporal-extent)
(compute-ticks domain pixel-range scale-spec spacing temporal-extent separators)
(compute-ticks domain
               pixel-range
               scale-spec
               spacing
               temporal-extent
               separators
               whole?)

Compute tick values and labels for a domain+pixel range, using wadogo transiently. When temporal-extent is provided (a [min max] pair of temporal objects), uses wadogo :datetime scale for calendar-aware ticks and formatting. When scale-spec contains :breaks (a vector of numbers), those exact values are used as ticks instead of the auto-computed ones -- ggplot2's scale_*_continuous(breaks = ...) equivalent. When scale-spec also contains :tick-labels (a vector of strings), those replace the auto-formatted labels at the corresponding break positions.

whole? says whether every value the domain came from is a whole number. It cannot be read off the domain, which arrives padded: a whole 40 to 60 reaches here as 39 to 61. A numeric axis whose values are whole is ticked at whole numbers rather than at the halves wadogo picks when the span is small and the count asked for is not.

On a categorical axis, :breaks selects which categories get a tick (ggplot2's discrete breaks): each break is matched to a category by its displayed label, unmatched breaks are dropped with a warning, and :tick-labels relabels the kept ticks. Explicit :breaks take precedence over :n-ticks -- when both are given, the exact breaks win and no thinning is applied.

Compute tick values and labels for a domain+pixel range, using wadogo transiently.
When temporal-extent is provided (a [min max] pair of temporal objects),
uses wadogo :datetime scale for calendar-aware ticks and formatting.
When `scale-spec` contains `:breaks` (a vector of numbers), those
exact values are used as ticks instead of the auto-computed ones
-- ggplot2's `scale_*_continuous(breaks = ...)` equivalent. When
`scale-spec` also contains `:tick-labels` (a vector of strings), those
replace the auto-formatted labels at the corresponding break
positions.

`whole?` says whether every value the domain came from is a whole
number. It cannot be read off the domain, which arrives padded: a
whole 40 to 60 reaches here as 39 to 61. A numeric axis whose values
are whole is ticked at whole numbers rather than at the halves
wadogo picks when the span is small and the count asked for is not.

On a categorical axis, `:breaks` selects which categories get a tick
(ggplot2's discrete `breaks`): each break is matched to a category by
its displayed label, unmatched breaks are dropped with a warning, and
`:tick-labels` relabels the kept ticks. Explicit `:breaks` take precedence
over `:n-ticks` -- when both are given, the exact breaks win and no
thinning is applied.
sourceraw docstring

draft->planclj

(draft->plan draft)
(draft->plan draft
             {:keys [x-label y-label title subtitle caption scales
                     legend-position grid-cols grid-rows]
              :as opts})

Pipeline: convert a draft into a plan using panel-based grid layout. Grid position from structural columns.

New layout pipeline (2026-04-11): stats first, then scene → padding → dimensions, then per-panel ticks at the now-known panel dimensions. :width/:height are total SVG dimensions; panel dimensions are derived by subtracting layout overhead. :panel-width/:panel-height in opts are escape hatches that pin panel size on their axis.

Pipeline: convert a draft into a plan using panel-based grid layout.
Grid position from structural columns.

New layout pipeline (2026-04-11): stats first, then scene → padding →
dimensions, then per-panel ticks at the now-known panel dimensions.
`:width`/`:height` are total SVG dimensions; panel dimensions are
derived by subtracting layout overhead. `:panel-width`/`:panel-height`
in opts are escape hatches that pin panel size on their axis.
sourceraw docstring

resolve-panel-draft-layersclj

(resolve-panel-draft-layers panel-draft-layers
                            all-colors
                            cfg
                            &
                            {:keys [resolved shape-map extents]})

Resolve draft layers and compute stats for a group of draft layers belonging to one panel. If pre-resolved draft layers are provided, skips resolve-draft-layer. :shape-map is the plot-wide category-to-symbol assignment, carried onto every layer so the marks draw the symbols the legend advertises. :extents is the plot-wide [lo hi] per continuous appearance aesthetic, carried the same way and for the same reason: a mark is scaled against every value the plot holds rather than against its own layer or its own panel, so the swatch beside a value is the quantity a mark of that value is drawn at wherever it sits. Returns {:resolved [...] :stat-results [...] :layers [...]}.

Resolve draft layers and compute stats for a group of draft layers belonging to one panel.
If pre-resolved draft layers are provided, skips resolve-draft-layer.
`:shape-map` is the plot-wide category-to-symbol assignment, carried
onto every layer so the marks draw the symbols the legend advertises.
`:extents` is the plot-wide `[lo hi]` per continuous appearance
aesthetic, carried the same way and for the same reason: a mark is
scaled against every value the plot holds rather than against its
own layer or its own panel, so the swatch beside a value is the
quantity a mark of that value is drawn at wherever it sits.
Returns {:resolved [...] :stat-results [...] :layers [...]}.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close