(categorical-domain? dom)True if domain is a sequence of non-numeric values (categorical).
True if domain is a sequence of non-numeric values (categorical).
(format-log-ticks ticks)Format log scale tick values. Values are always clean 1-2-3-5 multiples of powers of 10, so formatting is straightforward: integers >= 1 shown without decimals, sub-1 values use minimal decimal places.
Format log scale tick values. Values are always clean 1-2-3-5 multiples of powers of 10, so formatting is straightforward: integers >= 1 shown without decimals, sub-1 values use minimal decimal places.
(format-ticks sx ticks)(format-ticks sx ticks separator)Format tick values: integers shown without decimals, floats rounded to the precision implied by the tick step size (avoids floating-point noise like 0.30000000000000004). Falls back to wadogo formatting only when the step cannot be determined (< 2 ticks).
The 3-arity groups the digits of each formatted tick with separator
(the :thousands-separator configuration key). Layout measures label
widths through this same function, so a grouped axis reserves room for
the separators it will draw.
Format tick values: integers shown without decimals, floats rounded to the precision implied by the tick step size (avoids floating-point noise like 0.30000000000000004). Falls back to wadogo formatting only when the step cannot be determined (< 2 ticks). The 3-arity groups the digits of each formatted tick with `separator` (the `:thousands-separator` configuration key). Layout measures label widths through this same function, so a grouped axis reserves room for the separators it will draw.
(log-ticks [lo hi] n)Generate clean log-scale tick values for a [lo hi] domain, targeting approximately n ticks. Uses ggplot2-style 1-2-5 nice numbers instead of wadogo's linear-in-log-space approach (which produces irrational values like 3.162...). Returns a vector of tick values (doubles).
Strategy:
Generate clean log-scale tick values for a [lo hi] domain, targeting approximately n ticks. Uses ggplot2-style 1-2-5 nice numbers instead of wadogo's linear-in-log-space approach (which produces irrational values like 3.162...). Returns a vector of tick values (doubles). Strategy: - Powers of 10 only when they give >= 3 ticks (strongly preferred) - 1-2-5 intermediates per decade when more ticks are needed - 1-2-3-5 intermediates for dense sub-decade ranges - Bounding powers of 10 are included when they fall within a small margin (15% of log-span) of the domain edges
Create a wadogo scale mapping domain values to a pixel range.
Create a wadogo scale mapping domain values to a pixel range.
(pad-domain [lo hi] scale-spec)Add padding to a numeric domain. When lo == hi (constant data), pads by ±1 or ±5% of |lo|, whichever is larger. For log scales, callers must supply positive lo and hi -- the responsibility for excluding non-positive values lives upstream (filter-log-nonpositive for raw data, the scale-aware branch of compute-global-y-domain for stat-derived ranges).
Add padding to a numeric domain. When lo == hi (constant data), pads by ±1 or ±5% of |lo|, whichever is larger. For log scales, callers must supply positive lo and hi -- the responsibility for excluding non-positive values lives upstream (filter-log-nonpositive for raw data, the scale-aware branch of compute-global-y-domain for stat-derived ranges).
(scale-kind domain scale-spec)Determine the wadogo scale type (:categorical, :log, or :linear) from domain and spec. Passes through vector dispatch values like [:linear :doc] for doc defmethods.
Determine the wadogo scale type (:categorical, :log, or :linear) from domain and spec. Passes through vector dispatch values like [:linear :doc] for doc defmethods.
(tick-count pixel-range spacing)Suggested tick count based on available pixel range.
Suggested tick count based on available pixel range.
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 |