https://scicloj.github.io/plotje/ - composable plotting - https://clojars.org/org.scicloj/plotje:
This release mostly follows the https://clojurians.zulipchat.com/#narrow/channel/610149-plotje/topic/label.20positioning/with/614859539 label positioning> topic thread. Many thanks to @carsten.behring @timothypratley @smith.adriane and @tsulej for the fruitful work over that thread.
• See the new https://scicloj.github.io/plotje/plotje_book.placing_marks.html documentation chapter for the main fruits of this release.
• new function`pj/frames`reports where a plot's panels sit on the canvas: per panel, the`:panel-box`and`:drawing-area`rectangles in drawing units, plus the`:canvas`once for the plot. A composite reports every cell in canvas coordinates. Plain data throughout. - thanks, @timothypratley
• new functions`pj/to-drawing`and`pj/to-data`map between data space and drawing space for one panel of`pj/frames`. Both take a single x and y, or a dataset with`:x`and`:y`columns, and answer in kind.`pj/to-data`throws under`:polar`, which has no inverse; a panel's`:invertible?`says which case it is.
• new layer options`:offset-x`and`:offset-y`shift a layer by a number of drawing units, after the scales run -- the distance a label needs to clear its point. A nudge cannot: it shifts by a data amount, and throws on a categorical axis. Every layer type takes them, and a numeric domain widens to keep an offset label whole. - thanks, @carsten.behring
• :xand`:y`may be given as a value, not only as a column. Both as values draws one mark:`(pj/lay-text pose {:x 6.5 :y 3.5 :text "mean"})`. One value beside a column repeats for every row, so`{:x 33 :y :revenue}`labels each row at one fixed x. The value counts toward the axis domains, as ggplot2's`annotate()`does. - thanks, @carsten.behring
• new layer option`:in`names the space a layer's`:x`and`:y`are in:`:data`(default) or`:drawing-area`, which measures drawing units from the top left of the panel background.`(pj/lay-text pose {:in :drawing-area :x 12 :y 12 :text "n = 150"})`puts a note in the corner without touching the domains.
• pj/lay-rule-*and`pj/lay-band-*`warn that they do not accept`:in`, instead of taking it and doing nothing. They are placed from data values only.
• fix:`:group`no longer discards a fixed`:color`.`(pj/lay-line data :x :y {:group :country :color "#d0d0d0"})`draws one line per country, all in that grey; before, each line took a different palette color.
• fix:`{:tooltip true}`and`{:brush true}`work in the browser again. Since 0.7.0 the Scittle scripts reached the page with`"`where they wrote`"`, and a script element's content is raw text in HTML, so nothing decoded them back and neither interaction ran.
• fix: the brush's selection rectangle follows the drag when CSS scales the plot. In a column narrow enough to halve the plot, a drag of 150 by 100 drew a marquee of 75 by 50, at half the distance from the corner. Which rows a release selects is unchanged.
• a text mark that widens its axis to be drawn in full now leaves a few drawing units of air, so the last glyph no longer touches the panel edge.
• docstrings saydrawing unitswhere they said pixels: one unit of the plot's`:width`and`:height`, which is a screen pixel only at the plot's natural size on a standard-resolution display.