Cannot use PlotlyJS

Hi, I have a fresh Julia install on a new computer (windows 11). I can’t install PlotlyJS.

import Pkg; Pkg.add("PlotlyJS")
using PlotlyJS

After the using command, the repl gets stuck indefinitely. Interrupting it returns:

Note: after that, I can plot(). But I can’t use local packages depending on PlotlyJS.

Thanks for your help :slight_smile:

If you just need plotly.js, have you try PlotlyLight.jl ?

I had too many problems with PlotlyJS.jl / Plots.jl and the plotlyjs() backend in pluto notebooks and this was a great lightweight alternative.

2 Likes

PlotlyJS was updated recently see the changes here.
You might post an issue here, maybe the new PlotlyJS does not automatically install all necessary packages …
What happens, if you install kaleido?

PlotlyLight seems like a very reasonable alternative to PlotlyJS for what I want to accomplish, thanks!

Thank you for your help.
I have tried to use PlotlyJS after installing Kaleido, but I get the same behavior.
I’ll post an issue on the PlotlyJS Github.

1 Like

Hi,

PlotlyJS works fine for me, both in VSCode and in Pluto notebooks. And I use it quite a lot.

In VSCode it works out of the box.

In Pluto, we have two possibilities to render the plots. One is to use PlotlyJS directly. In this case, without specifying the Layout attributes for height and width the plot will come as the following one (not very helpful):

Adding those attributes to the code is all that is required to have a plot that looks immaculate:

If we follow this approach, there may be a problem: if we create a static version of the notebook, the plots will appear as they look in the first image above, even though they are OK in the active notebook.

@disberd has developed a hack in a small package named PlutoPlotly.jl that overcomes the problem above. It even allows the use of LaTeX content in the plots. See the following image, for an example:

3 Likes

Thanks @VivMendes for mentioning PlutoPlotly,
The package also got a new breaking release recently and now should have feature parity with PlotlyJS so that every function you can use in PlotlyJS also works in PlutoPlotly.

I am also working on a new release to have it work also outside of Pluto (both standalone html and vscode/documenter) so that it can be potentially used as an alternative to PlotlyBase/PlotlyJS with the same syntax, since those two packages have been having some issues with updates

4 Likes

Please let me know, as soon as this is possible I would like to test your package,
what about, the feature toggleitem, does your package support this feature?

I’ll reply here tagging you when that is released.
Regarding the toggle item feature it is only related to the underlying plotly version so it is supported.
PlutoPlotly uses a much more recent default version of the JS library and make it easy to use a custom version if needed.

1 Like

The specific issue with PlotlyJS and kaleido not working on windows should now be fixed after version 2.2.4 of PlotlyKaleido was released.

In machines where the problem was happening it is still required to downgrade Kaleido_jll to version 0.1 but this is now mentioned as a warning when loading the package. See this github comment for more details.

3 Likes