You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Avoiding jsDelivr CDN and using local or other #525
Great, thank you. It's the include_plotlyjs option of the to_html function. Now I just need to figure out how to wire things together for my two use-cases:
View notebook in browser locally
Publish static blog
I'm mostly interested in 1. for now! Any tips appreciated.
PlotlyJS exports the savefig function, and you can pass the include_plotlyjs keyword to argument directly.
So
julia>using PlotlyJS
julia> p1 =plot(scatter(;y=randn(3)));
julia> PlotlyBase.embed_plotlyjs =false# this puts the path in the file (and actually covers up a bug!)
julia>open("my_local_plot.html", "w") do io
PlotlyBase.to_html(io, p1.plot; include_plotlyjs="assets/plotly-2.33.0.min.js", include_mathjax=missing)
end
Reacted by Nikolaos Chatzikonstantinou
createyourpersonalaccount commented on May 8, 2026
Thank you! Now I just have to figure out how to do this in Pluto.jl's interactive notebook, but that might be a question for them.
PS. It's a bit confusing that the readme says "This package constructs plotly graphics using all local resources." isn't it? By default that's not true for plotly.min.js...
Yes I use it! I should've said that I want the js script to be local for PlutoPlotly.jl. I believe they've hardcoded the value. On the other hand, I'm seriously considering paying that license to Mathematica because dynamic plots need a lot of fine-tuning with plotly :(
Activity
jd-foster commentedon May 7, 2026
The way to do this is through the
Base.showmethods implemented in PlotlyBase here:https://github.com/sglyon/PlotlyBase.jl/blob/master/src/output.jl
How are you displaying your plots (in the browser, via the REPL, saving with Kaleido)?
createyourpersonalaccount commentedon May 7, 2026
Great, thank you. It's the
include_plotlyjsoption of theto_htmlfunction. Now I just need to figure out how to wire things together for my two use-cases:I'm mostly interested in 1. for now! Any tips appreciated.
jd-foster commentedon May 8, 2026
PlotlyJS exports the
savefigfunction, and you can pass theinclude_plotlyjskeyword to argument directly.So
createyourpersonalaccount commentedon May 8, 2026
Thank you! Now I just have to figure out how to do this in Pluto.jl's interactive notebook, but that might be a question for them.
PS. It's a bit confusing that the readme says "This package constructs plotly graphics using all local resources." isn't it? By default that's not true for plotly.min.js...
jd-foster commentedon May 8, 2026
Fair point - the language should be updated to be clearer.
I assume you know about this?
https://github.com/JuliaPluto/PlutoPlotly.jl
createyourpersonalaccount commentedon May 9, 2026
Yes I use it! I should've said that I want the js script to be local for PlutoPlotly.jl. I believe they've hardcoded the value. On the other hand, I'm seriously considering paying that license to Mathematica because dynamic plots need a lot of fine-tuning with plotly :(