Stream: helpdesk (published)

Topic: Displaying SVG images with Javascript using Julia and Jupyte


view this post on Zulip Davi Sales Barreira (Jun 17 2024 at 12:59):

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?

view this post on Zulip Davi Sales Barreira (Jun 17 2024 at 13:02):

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.

view this post on Zulip James Foster (Jun 21 2024 at 12:16):

PlotlyJS uses WebIO, Makie uses JSServe ?


Last updated: Dec 28 2024 at 04:38 UTC