Settings

Theme

Show HN: Minimalist library to generate SVG views of scientific data

github.com

47 points by afc 21 days ago · 4 comments · 1 min read

Reader

Just wanted to share with HN a simple/minimal open source Python library that generates SVG files visualizing two dimensional data and distributions, in case others find it useful or interesting.

I wrote it as a fun project, mostly because I found that the standard libraries in Python generated unnecessarily large SVG files. One nice property is that I can configure the visuals through CSS, which allows me to support dark/light mode browser settings. The graphs are specified as JSON files (the repository includes a few examples).

It supports scatterplots, line plots, histograms, and box plots, and I collected examples here: https://github.com/alefore/mini_svg/blob/main/examples/READM...

I did this mostly for the graphs in an article in my blog (https://alejo.ch/3jj).

Would love to hear opinions. :-)

WaryByDesign 17 days ago

Other than that the graphs look good, I don't have much to say about the code (not a Python person), but I think the approach is great, mostly because I like using custom-generated SVGs for visualizations myself as well.

The only downside I've experienced is that it's pretty much impossible to get data-dependent interactions (tooltips and clickable links that vary based on section) to work reliably: additional Javascript has gotten me to like 80% on desktop, but not on mobile.

emilbratt 17 days ago

Looks neat! As someone who also did a barplot library with SVG output, I can tell you that this sort of program is really fun to write.

https://crates.io/crates/eb_bars

santiago-pl 17 days ago

I like how the plots look!

In recent months, I’ve been making charts for the benchmarks just by talking to Claude Code or Codex: “Generate the charts for this and that.”

I could try pointing it to your project next time. It would be easier to do with some kind of easy-to-install skills for AI agents.

I think it’s an inevitable trend this year, something people call "building for agents." (I saw someone phrase it that way on X.)

groundzeros2015 17 days ago

How does it compare to gnuplot svg output?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection