Convert membrane drawable trees to SVG hiccup.
Convert membrane drawable trees to SVG hiccup.
(hiccup->svg-str elem)Convert SVG hiccup to an SVG string. Handles the subset of hiccup used by plotje: vectors with tag + optional attrs map + children.
Convert SVG hiccup to an SVG string. Handles the subset of hiccup used by plotje: vectors with tag + optional attrs map + children.
(membrane->svg elem)(membrane->svg elem ctx)Convert a membrane drawable element to SVG hiccup. ctx tracks inherited drawing state (color, style, stroke-width).
Convert a membrane drawable element to SVG hiccup. ctx tracks inherited drawing state (color, style, stroke-width).
(rgba->css [r g b a])Convert [r g b] or [r g b a] to CSS rgb string and opacity.
Convert [r g b] or [r g b a] to CSS rgb string and opacity.
(svg-summary svg)(svg-summary svg theme)Extract structural summary from SVG hiccup for testing. Returns a map with :width, :height, :panels, :points, :lines, :dashed-lines, :polygons, :tiles, :visible-tiles, :texts, :colors, :sizes, :alphas, :dash-patterns, and :shapes — useful for asserting plot structure and that aesthetic mappings (color/size/alpha/shape) took effect. (svg-summary (plot pose)) — summary of rendered SVG
Structure counts:
:panels — number of plot panels (large background rectangles)
:points — number of data point markers drawn as small rounded rects:
circle and :square shape symbols. The :triangle and
:diamond symbols draw as paths and count under :polygons,
so a shape-mapped scatter splits across the two counts.
Every marker sits on a square bounding box, which is what
distinguishes one from a label's background box
:lines — number of non-grid polylines (data lines, annotations, whiskers)
:dashed-lines — number of polylines with a stroke-dasharray (dashed/dotted
lines, dashed rules, dashed area outlines)
:polygons — number of filled polygons (bars, histogram bins, areas, violins)
:tiles — number of heatmap tile rectangles (small rects without border-radius)
:visible-tiles — tiles with positive width and height (excludes degenerate zero-extent tiles)
:clips — number of clipPath definitions (one per panel per clip region in use: the drawing area for data marks, plus the panel box when a margin mark such as rug is present)
:texts — vector of all text content strings
:bold-texts — number of texts drawn with :font-weight :bold
:italic-texts — number of texts drawn with :font-style :italic
:label-boxes — number of text background boxes, one per boxed label
(from pj/lay-label, or pj/lay-text with :box)
Aesthetic-coverage sets (extracted across data shapes only;
theme/legend/axis chrome is excluded):
:colors — sorted set of distinct fill/stroke colors
:sizes — sorted set of distinct positive point :rx values. A :square
marker draws with an :rx of 0 whatever its size, so squares
are counted in :points but contribute nothing here
:alphas — sorted set of distinct non-default opacity values
:dash-patterns — sorted set of distinct stroke-dasharray strings (the
dash/gap pattern, in pixels; :dashed and :dotted differ)
:shapes — sorted set of distinct SVG element types used by data marks
Accepts an optional theme map to detect grid-colored polylines correctly when a custom theme is used.
Extract structural summary from SVG hiccup for testing.
Returns a map with :width, :height, :panels, :points, :lines,
:dashed-lines, :polygons, :tiles, :visible-tiles, :texts, :colors,
:sizes, :alphas, :dash-patterns, and :shapes — useful for asserting
plot structure and that aesthetic mappings (color/size/alpha/shape)
took effect.
(svg-summary (plot pose)) — summary of rendered SVG
Structure counts:
:panels — number of plot panels (large background rectangles)
:points — number of data point markers drawn as small rounded rects:
circle and `:square` shape symbols. The `:triangle` and
`:diamond` symbols draw as paths and count under :polygons,
so a shape-mapped scatter splits across the two counts.
Every marker sits on a square bounding box, which is what
distinguishes one from a label's background box
:lines — number of non-grid polylines (data lines, annotations, whiskers)
:dashed-lines — number of polylines with a stroke-dasharray (dashed/dotted
lines, dashed rules, dashed area outlines)
:polygons — number of filled polygons (bars, histogram bins, areas, violins)
:tiles — number of heatmap tile rectangles (small rects without border-radius)
:visible-tiles — tiles with positive width and height (excludes degenerate zero-extent tiles)
:clips — number of clipPath definitions (one per panel per clip region in use: the drawing area for data marks, plus the panel box when a margin mark such as rug is present)
:texts — vector of all text content strings
:bold-texts — number of texts drawn with :font-weight :bold
:italic-texts — number of texts drawn with :font-style :italic
:label-boxes — number of text background boxes, one per boxed label
(from `pj/lay-label`, or `pj/lay-text` with `:box`)
Aesthetic-coverage sets (extracted across data shapes only;
theme/legend/axis chrome is excluded):
:colors — sorted set of distinct fill/stroke colors
:sizes — sorted set of distinct positive point :rx values. A `:square`
marker draws with an :rx of 0 whatever its size, so squares
are counted in :points but contribute nothing here
:alphas — sorted set of distinct non-default opacity values
:dash-patterns — sorted set of distinct stroke-dasharray strings (the
dash/gap pattern, in pixels; :dashed and :dotted differ)
:shapes — sorted set of distinct SVG element types used by data marks
Accepts an optional theme map to detect grid-colored polylines correctly
when a custom theme is used.Convert a membrane drawable element to SVG hiccup.
Convert a membrane drawable element to SVG hiccup.
(-to-svg elem ctx)(wrap-svg width height body)(wrap-svg width height body title)Wrap SVG hiccup body in an <svg> root element.
Wrap SVG hiccup body in an <svg> root element.
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 |