Complex plot mark

I made a custom mark for showing complex functions. It can be changed simply to render GLSL shaders. I tried my best to avoid any memory leak and optimized it as much as I knew and was able, but if you find something I missed, let me know.

Wow, this is awesome. Great use of a custom mark in Observable Plot, and integrating d3-zoom! We think this might be the first example we’ve seen of using GLSL in a custom Plot mark.

There are some similarities with Ricky Reusser’s complex function plotter (see implementation). Ricky also has a fantastic notebook on adaptive contouring. Check those out if you haven’t seen them already.

Fil and I are hoping to bring native support for zooming to Plot soon (or, eventually), which might make this slightly easier. In any case, well done, and thank you for sharing! :clap:

Thanks! There is one issue I haven’t figured out how to fix. When the resolution is smaller than the plot, it gets stretched to fit the screen, and d3-zoom breaks.