I've been busting my brains trying to understand how to display images with interactivity within Jupyter. I have written some Julia code that produces SVG strings. I can render it in Jupyter using HTML(mysvg_string)
. The problem arises when trying to add some javascript to provide interactivity.
I've tried creating a full HTML file and placing the javascript <script>
tag. But this did not work. I also tried placing the tag within the svg using CDATA
. Also did not work. This last option seems to be what packages like Gadfly.jl does. But I couldn't make it work for my case. Note that, if I open the html file in a browser, the interactivity does work. Hence, the issue seems to be something related to how to get it to work on Jupyter (I think).
Does anybody know an easy example to make this work?
I'm quite confused by how things are displayed within Jupyter notebooks, and the whole "MIME" thing. Tried reading on it, but couldn't quite grasp it. Any references on this topic would be highly appreciated.
Also, one of my goals (I don't know how possible) would be to incorporate Javascript packages such as "Three.js" in order to have 3D visualizations... Packages such as Plotly and Makie make this work, but I have know idea how they do this.
PlotlyJS uses WebIO, Makie uses JSServe ?
Last updated: Nov 22 2024 at 04:41 UTC