I would like to construct a simple Mandelbrot browser in Pluto. In particular, I’d like to be able to put my mouse pointer on a point on a plot, read the position (preferably a complex number) and press a mouse button to zoom into that area of the plot.
If anyone could share some example code with me, I’d appreciate it. Thanks.
Thanks very much for your help on this. I didn’t know this was out there, and the tooltips are wonderful.
However, I’d like to be able to click the mouse on a point and get the coordinates in the tooltip back into my code. There’s some example code in the markdown, but I can’t make heads or tails of it. Does anyone have a working example?
Hi @bobmccrory, do I understand correctly that you’d want to use the coordinates of the click point to:
- Zoom the plot around that point
- Use the extracted coordinates on the julia side to compute the new points of the set with more precision on the newly zoomed area
- Update the plot to show the newly computed points on the julia side
This is because currently the coordinates extraction from Pluto is triggered every time the cell is rerun, so this extraction and update of the same plot will potentially create an infinite update loop.
Thank you, disberd, for your comprehensive and, I might add, very well written reply.
What I imagine is the kind of interactive zooming in that one finds in Mandelbrot browsers on the Web. They are beautiful, and I had hoped to create one of my own using Pluto. For now, I’ll content myself with using the tooltips to find points of interest and then manually entering the coordinates into Pluto for a closer look.
@bobmccrory There is now a draft PR in Pluto to have this more advanced communication between JS and Julia.
It is still a work in progress but your mandelbrot example is much easier to implement with this additional functionality.
I used the julia code from @lungben in Mandelbrot with Plots.jl for computing the colors in the plot.
You can check the notebook code in my comment to the PR itself, but you do need to use the Pluto version of the PR branch to start the server if you want to test this yourself.
Thank you for keeping me posted on this. I’m on another project right now, but I’m looking forward to revisiting the Mandelbrot project again. With the new changes, we are close to being able to use Pluto to build a real user interface.