A plotting library for Clojure: plots are plain maps of data, mappings and charts, built and rendered by functions.
- Pure JVM: renders
BufferedImages and image files, no browser or JavaScript. - Built on fastmath (statistics, distributions, layouts), wadogo (scales), clojure2d (drawing, colours) and malli (validated options with readable errors).
- Charts: scatter, line, bar, histogram, density, box, violin, ribbon, smooth, heatmaps, 2D fields and contours, Q-Q / P-P, treemap, sunburst, circle packing, waffle, Venn, networks, dendrograms, chord, arc and sankey diagrams, and more; facets, polar coordinates, margins, multiplots.
There's no release yet. Use a git coordinate in deps.edn:
io.github.generateme/cljplot2 {:git/sha "2ae278d772277fc9341e287793d41c83af697698"}cljplot2 depends on SNAPSHOT versions: fastmath 3.0.0-alpha10-SNAPSHOT is on Clojars; clojure2d
1.5.0-alpha3-SNAPSHOT and wadogo 1.1.0-alpha2-SNAPSHOT aren't yet - install them locally from their repositories.
(require '[cljplot2.core :as plot]
'[cljplot2.chart :as chart]
'[clojure2d.core :as c2d])
(def data
(for [series ["sin" "cos"]
x (range 0 6.3 0.1)]
{:x x :y ((if (= series "sin") Math/sin Math/cos) x) :series series}))
(-> {:data data
:mapping {:x :x :y :y :color :series}
:charts [(chart/line) (chart/scatter)]
:labels {:title "Hello, cljplot2"}}
(plot/render-image {:width 600 :height 350})
(c2d/save "example.png"))The book: https://generateme.github.io/cljplot2/ - use cases after the R Graph Gallery and data-to-viz:
Galleries (in progress): cljplot extras - the examples of the original cljplot (Q-Q / P-P, ACF, vector fields, complex functions, ...); lattice and Vega galleries are planned.
Every public function has a docstring; namespaces: cljplot2.core (build, render, builders), cljplot2.chart
(charts), cljplot2.data.* (row and layout functions).
clojure -M:test # tests
clojure -M:check # reflection and boxed-math warnings
clojure -M:demo # demo images to results/ (and the logo to img/)
clojure -M:clay # the book into docs/Copyright © GenerateMe and contributors.
Developed with the support of an LLM (Anthropic's Claude) - design, code, tests and documentation were reviewed by the author.
Distributed under the Eclipse Public License 2.0.
The bundled font, DejaVu Sans Mono (resources/fonts/), keeps its own licence: Bitstream Vera Fonts licence, DejaVu
changes in the public domain - see LICENSE-DejaVu.txt.

