←back to thread

An SVG is all you need

(jon.recoil.org)
258 points sadiq | 2 comments | | HN request time: 0.422s | source
Show context
tylervigen ◴[] No.46240126[source]
Two years ago I re-vamped my "Spurious Correlations" side project, which is mostly just a bunch of charts. However, I couldn't find a charting software I liked that would display clean, simple visuals with the constraints I wanted. (I had used pCharts and HighCharts in the past, but didn't like charting in Javascript or PHP.)

I decided to "roll my own" and write Python scripts that outputted SVG markup. I was worried this would go about as well as every other "roll your own" project does, but was pleasantly surprised. It is surprisingly easy to output reliable, good-looking SVG graphics using Python. If you are making a chart, everything is just math.

The infinite scalability is almost just a happy upside to the simplicity of creating the visualizations, which is annoying in raster format. It made me like SVG even more.

replies(3): >>46240143 #>>46240416 #>>46240918 #
eru ◴[] No.46240143[source]
It's a bit sad that Postscript never caught on as much as it could have. In an alternate timeline, it could have been the HTML (and SVG) we got in ours.
replies(1): >>46240200 #
shakna ◴[] No.46240200[source]
Postscript is still everywhere. Its just out of sight, being used as a compile target.

PDF may have "officially" replaced it, but it is still embedded almost everywhere you look.

replies(1): >>46240253 #
eru ◴[] No.46240253[source]
PDF is a sad replacement for PS. As far as I can tell, it was an attempt to obscure PS, because alternative vendors were getting better as Postscript than the originators.

(There was some justification in terms of 'Oh, a binary format like PDF is more space efficient.' But PDF never really was more efficient than compressed PS.)

It's not that PS has vanished, but PS isn't nearly as 'everywhere' as HTML came to be.

replies(2): >>46240658 #>>46240844 #
1. tambourine_man ◴[] No.46240658[source]
PDF is also a lot less powerful, purposefully so. You can start an infinite loop just by double-clicking a PS file, for instance.

It is extremely useful to have a full programing language as a file format, though.

I miss macOS’s Preview.app auto-converting PS to PDF when double-clicked. It was a way to easily distribute a document that could randomize question orders each time it opened, print multiple bingo cards from a single file, etc.

The stack-based and reverse Polish notation thing was also fun.

replies(1): >>46242021 #
2. eru ◴[] No.46242021[source]
You could have made a deliberately restricted subset of PS without going all binary.

Btw, doesn't PDF include Javascript these days? So you can still randomise stuff at view-time in a PDF. See https://th0mas.nl/2025/01/12/tetris-in-a-pdf/