PlotlyJS causes errors, can't figure out how to use PlotlyLight - how to use Plotly from Julia?

@jojob68 , welcome.

What editor are you using: VScode, Pluto, or any other?

There is no problem with plotting with PlotlyJS.jl if you use this package inside the VScode editor. If you type and run sequentially:

using PlotlyJS
aa=plot(randn(300))
savefig(aa, "aa.png")

the plot will first appear on the monitor, and then you can save it as you wish (PNG, PDF, SVG,…)

If you use Pluto.jl (a Julia package itself and a remarkable IDE), you should not use PlotlyJS.jl directly; otherwise, you will get the usual Kaleido problems. In Pluto, if you want to plot with the functionalities of PlotlyJS.jl, it would be best if you used PlotlyBase.jl instead, which is the partner of PlotlyJS that, in fact, renders the plots created by the former. For more details on how to use PlotlyJS.jl inside Pluto, check this thread Cannot use PlotlyJS .

Finally, if you want to use PlotlyJS and not bother about what IDE you should use, you can use PlutoPlotly.jl, a package developed by @disberd that mimics the functionalities of PlotlyJS and always works out of the box.

I do a lot of plotting using the functionalities of PlotlyJS.jl and it do not regret it. It is a wonderful package.

1 Like