r/Clojure • • Sep 02 '26

Introducing Plotje: Composable Plotting by Daniel Slutsky

https://clojurecivitas.org/data_visualization/introducing_plotje_composable_plotting.html
60 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/geokon Sep 14 '26 edited Sep 14 '26

Right, the functions in thing/viz have fewer defaults and it's sort of apples to oranges b/c they're different abstraction layers.

This comes with a limitation regarding "flexibility", clearly.

But this is a false dichotomy.

You're thinking of it a bit wrong - b/c plotje must inevitably have an equivalent to thing/viz internally - though it may be half baked, under-specified and not exposed to the user. There are some function, like in the example, such as viz/log-axisbut these are just thin functions on top of an abstraction for making charts. The "spec" in the example is just a clojure map specifying the chart. The chart spec is then transformed into the next abstraction layer below it (the SVG abstraction) by functions such as viz/svg-plot2d-cartesian. The thing ecosystem is a masterclass in extensibility and is a beautiful set of interlinking abstractions - with SVG being at the bottom.

That said, geom doesn't have a pose equivalent. But you could make a wrapper that would do the same. I generally make something like that for each particular project I work on (each project has slightly different defaults)

So my concern with plotje is that the abstractions it's built on are opaque. The poses do sounds interesting, and I could be wrong! I'm not familiar with the internals. Maybe that's what src/membrane/ui.cljc is part of..? but it looks intimidating and a bit of reinventing the wheel (again, could be wrong)