Liking cljdoc? Tell your friends :D

scicloj.plotje.impl.scale


categorical-domain?clj

(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).
sourceraw docstring

format-log-ticksclj

(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.
sourceraw docstring

format-ticksclj

(format-ticks sx ticks)

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).

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).
sourceraw docstring

log-ticksclj

(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:

  • 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
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
sourceraw docstring

make-scalecljmultimethod

Create a wadogo scale mapping domain values to a pixel range.

Create a wadogo scale mapping domain values to a pixel range.
sourceraw docstring

pad-domainclj

(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.

Add padding to a numeric domain. When lo == hi (constant data),
pads by ±1 or ±5% of |lo|, whichever is larger.
sourceraw docstring

scale-kindclj

(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.
sourceraw docstring

tick-countclj

(tick-count pixel-range spacing)

Suggested tick count based on available pixel range.

Suggested tick count based on available pixel range.
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