I looked around but didn't find anything I liked. The regexp article [1] uses jgraph [2] to plot the data as eps, then ghostscript to turn eps to png. That no longer works in a world of variable-dpi screens, so for this article I generated SVGs and inlined them into the HTML. The SVGs are generated by a custom program I wrote for the job [3], to mimic the old jgraph graphs. It's not pretty code, but it gave me a lot of control over the presentation and produced decent results. You're welcome to adapt it if you like.
[1] https://swtch.com/~rsc/regexp/regexp1.html
[2] https://web.eecs.utk.edu/~plank/plank/jgraph/jgraph.html
[3] https://research.swtch.com/globgraph.go