Dynamic var for thread-local config overrides. Bind to a map to override any config keys for the current thread. (binding [defaults/config {:theme {:bg "#FFF"}}] ...)
Dynamic var for thread-local config overrides.
Bind to a map to override any config keys for the current thread.
(binding [defaults/*config* {:theme {:bg "#FFF"}}] ...)Per-aesthetic semantic properties. Single source of truth for the set of mapping keys that can reference dataset columns. :numeric? marks aesthetics whose column values, when present, are numeric -- those are the keys eligible for finite-value filtering at plan time.
Per-aesthetic semantic properties. Single source of truth for the set of mapping keys that can reference dataset columns. :numeric? marks aesthetics whose column values, when present, are numeric -- those are the keys eligible for finite-value filtering at plan time.
(c2d->rgba color)Convert a clojure2d color (Vec4, 0-255 channels) to [r g b a] in 0-1 range.
Convert a clojure2d color (Vec4, 0-255 channels) to [r g b a] in 0-1 range.
(color-for categories val)(color-for categories val palette)Look up the color for a categorical value from the palette. Returns [r g b a] in 0-1 range. palette can be: nil (default), a keyword (any clojure2d palette name), a vector of hex strings, or a map of {category-value color}.
Map lookup is tolerant of string/keyword mismatch: {:setosa "#F00"} matches both :setosa and "setosa" data values.
For keyword/vector palettes, the i-th category gets the i-th
palette entry (wrapping modulo the palette size). This preserves
the authorial ordering of designed-categorical palettes like
:set1, :dark2, :tableau-10. If you want a continuous color ramp
(viridis, inferno, etc.) for a numeric column, use the dedicated
:color-scale option instead -- that's the canonical gradient
path and interpolates the full color range smoothly.
Look up the color for a categorical value from the palette.
Returns [r g b a] in 0-1 range.
palette can be: nil (default), a keyword (any clojure2d palette name),
a vector of hex strings, or a map of {category-value color}.
Map lookup is tolerant of string/keyword mismatch: {:setosa "#F00"}
matches both :setosa and "setosa" data values.
For keyword/vector palettes, the i-th category gets the i-th
palette entry (wrapping modulo the palette size). This preserves
the authorial ordering of designed-categorical palettes like
:set1, :dark2, :tableau-10. If you want a continuous color ramp
(viridis, inferno, etc.) for a numeric column, use the dedicated
`:color-scale` option instead -- that's the canonical gradient
path and interpolates the full color range smoothly.Set of keywords that can reference dataset columns in mappings.
Set of keywords that can reference dataset columns in mappings.
(config)Return the effective resolved configuration as a map. Deep-merges: library defaults < plotje.edn < set-config! < config. Nested maps (e.g. :theme) are merged recursively. Useful for inspecting which values are in effect.
Return the effective resolved configuration as a map. Deep-merges: library defaults < plotje.edn < set-config! < *config*. Nested maps (e.g. :theme) are merged recursively. Useful for inspecting which values are in effect.
Documentation metadata for configuration keys. Each entry maps a key to [category description].
Documentation metadata for configuration keys. Each entry maps a key to [category description].
Default categorical palette name (clojure2d palette keyword).
Default categorical palette name (clojure2d palette keyword).
In-code fallback for keys not present in the EDN resource. The EDN
file (resources/plotje-defaults.edn) is the canonical source;
this map is consulted only when the EDN load fails or as a secondary
lookup in (or cfg defaults) patterns in stat/layout code.
In-code fallback for keys not present in the EDN resource. The EDN file (`resources/plotje-defaults.edn`) is the canonical source; this map is consulted only when the EDN load fails or as a secondary lookup in `(or cfg defaults)` patterns in stat/layout code.
Diverging gradient function (RdBu). Takes t in [0,1], returns [r g b a] 0-1.
Diverging gradient function (RdBu). Takes t in [0,1], returns [r g b a] 0-1.
(fmt-category-label v)Format a category value (keyword, string, number, etc.) for display. Keywords are rendered without their leading colon: :widget -> "widget". Used for axis tick labels, legend entries, facet strip labels, and any other user-visible category text.
Format a category value (keyword, string, number, etc.) for display. Keywords are rendered without their leading colon: :widget -> "widget". Used for axis tick labels, legend entries, facet strip labels, and any other user-visible category text.
(fmt-name k)Format a keyword as a readable name: :sepal-length -> "sepal length".
Format a keyword as a readable name: :sepal-length -> "sepal length".
Default gradient function (dark blue → light blue, matching ggplot2). Takes t in [0,1], returns [r g b a] 0-1.
Default gradient function (dark blue → light blue, matching ggplot2). Takes t in [0,1], returns [r g b a] 0-1.
Set of keywords that resolve to a continuous gradient rather than a
categorical palette. Users who pass these to :palette almost always
meant :color-scale with a numeric color column. plan/warn-palette-wrap!
fires a warning when it sees one of these on the :palette slot.
Set of keywords that resolve to a continuous gradient rather than a categorical palette. Users who pass these to `:palette` almost always meant `:color-scale` with a numeric color column. `plan/warn-palette-wrap!` fires a warning when it sees one of these on the `:palette` slot.
(hex->rgba color)Convert any color representation to [r g b a] in 0-1 range. Accepts hex strings (#RGB, #RRGGBB, #RRGGBBAA, or without #), named color strings ("red", "steelblue"), keywords (:red, :darkblue), or any value that clojure2d.color/to-color understands.
Convert any color representation to [r g b a] in 0-1 range.
Accepts hex strings (#RGB, #RRGGBB, #RRGGBBAA, or without #),
named color strings ("red", "steelblue"), keywords (:red, :darkblue),
or any value that clojure2d.color/to-color understands.Side length of legend color swatches (square, in pixels).
Side length of legend color swatches (square, in pixels).
(normalize-continuous scale-type v vmin vmax midpoint)Remap a value v from [vmin, vmax] to [0,1] using a scale-type aware transform. :linear (default) uses normalize-midpoint with the optional midpoint. :log uses log10 endpoints; midpoint is ignored under :log.
Remap a value v from [vmin, vmax] to [0,1] using a scale-type aware transform. :linear (default) uses normalize-midpoint with the optional midpoint. :log uses log10 endpoints; midpoint is ignored under :log.
(normalize-midpoint v vmin vmax midpoint)Remap a value v from [vmin, vmax] to [0,1] with optional midpoint. Without midpoint: linear (v-vmin)/(vmax-vmin). With midpoint: values below midpoint → [0, 0.5], above → [0.5, 1.0].
Remap a value v from [vmin, vmax] to [0,1] with optional midpoint. Without midpoint: linear (v-vmin)/(vmax-vmin). With midpoint: values below midpoint → [0, 0.5], above → [0.5, 1.0].
Aesthetics whose column values are numeric -- subject to finite-value filtering. Derived from aesthetic-registry.
Aesthetics whose column values are numeric -- subject to finite-value filtering. Derived from aesthetic-registry.
Documentation for plot-level option keys. These are accepted by pj/options, pj/plan, and pj/plot but are inherently per-plot (text content or nested config override). Each entry maps a key to [category description].
Documentation for plot-level option keys. These are accepted by pj/options, pj/plan, and pj/plot but are inherently per-plot (text content or nested config override). Each entry maps a key to [category description].
(resolve-config plot-opts)Resolve config with plot options deep-merged on top of the precedence chain.
Plot options have the highest priority. Any key from config-key-docs
passed directly in plot-opts is forwarded to the resolved cfg. Nested
maps (:theme) are merged recursively. The :config key is a deep-merge
escape hatch for arbitrary overrides.
Resolve config with plot options deep-merged on top of the precedence chain. Plot options have the highest priority. Any key from `config-key-docs` passed directly in plot-opts is forwarded to the resolved cfg. Nested maps (:theme) are merged recursively. The `:config` key is a deep-merge escape hatch for arbitrary overrides.
(resolve-gradient-fn color-scale)Resolve a :color-scale option to a gradient function t→[r g b a] (0-1 range). nil or :sequential → dark blue to light blue (ggplot2 default). :diverging → RdBu. keyword → clojure2d gradient name (:inferno, :viridis/plasma, etc.). map {:low hex :mid hex :high hex} → custom 3-stop gradient. function → used directly. Throws on unrecognized keyword.
Resolve a :color-scale option to a gradient function t→[r g b a] (0-1 range).
nil or :sequential → dark blue to light blue (ggplot2 default).
:diverging → RdBu.
keyword → clojure2d gradient name (:inferno, :viridis/plasma, etc.).
map {:low hex :mid hex :high hex} → custom 3-stop gradient.
function → used directly.
Throws on unrecognized keyword.(resolve-palette k)Resolve a keyword to a clojure2d palette, trying aliases. Returns a non-empty palette vector, falling back to the default palette.
Resolve a keyword to a clojure2d palette, trying aliases. Returns a non-empty palette vector, falling back to the default palette.
(set-config! m)Set global config overrides. Persists across calls until reset. (set-config! {:palette :dark2 :theme {:bg "#FFFFFF"}}) (set-config! nil) — reset to defaults
Set global config overrides. Persists across calls until reset.
(set-config! {:palette :dark2 :theme {:bg "#FFFFFF"}})
(set-config! nil) — reset to defaultsAvailable shape symbols for categorical shape mapping.
Available shape symbols for categorical shape mapping.
Default theme: background color, grid color, and font size.
Default theme: background color, grid color, and font size.
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 |