# Cannot use PlotlyJS

**URL:** <https://discourse.julialang.org/t/cannot-use-plotlyjs/105057>\
**Category:** New to Julia\
**Tags:** package, plotting\
**Created:** [October 17, 2023, 11:17am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057 "2023-10-17T11:17:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Guillaume](https://discourse.julialang.org/u/Guillaume)\
**Post date:** [October 17, 2023, 11:17am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/1 "2023-10-17T11:17:49Z")

</div>

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

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

```

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

 ![using_PlotlyJS](https://global.discourse-cdn.com/julialang/original/3X/6/7/6782472268bb064ce08ff414aa02878fa12500b0.png)

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

Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![vzion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vzion/32/44768_2.png) [@vzion](https://discourse.julialang.org/u/vzion)\
**Post date:** [October 17, 2023, 11:47am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/2 "2023-10-17T11:47:06Z")

</div>

If you just need plotly.js, have you try [PlotlyLight.jl](https://github.com/JuliaComputing/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.

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [October 17, 2023, 12:15pm UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/3 "2023-10-17T12:15:28Z")

</div>

`PlotlyJS` was updated recently see the changes [here](https://github.com/JuliaPlots/PlotlyJS.jl/compare/v0.18.10...v0.18.11).  
You might post an issue [here](https://github.com/JuliaPlots/PlotlyJS.jl/issues), maybe the new PlotlyJS does not automatically install all necessary packages …  
What happens, if you install [`kaleido`](https://github.com/tkf/Kaleido.jl)?

---

<div class="post-metadata">

**Author:** ![Guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Guillaume](https://discourse.julialang.org/u/Guillaume)\
**Post date:** [October 17, 2023, 1:18pm UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/4 "2023-10-17T13:18:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Guillaume](https://discourse.julialang.org/u/Guillaume)\
**Post date:** [October 17, 2023, 1:20pm UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/5 "2023-10-17T13:20:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [October 17, 2023, 9:54pm UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/6 "2023-10-17T21:54:03Z")

</div>

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):

 ![a](https://global.discourse-cdn.com/julialang/original/3X/5/6/567206a5120730cf426f023d51027f84f418cbde.png)

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

 ![aa](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f8145712e4810a32c7d4e74e392ec719c57c5d3.png)

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:

 ![aaa](https://global.discourse-cdn.com/julialang/original/3X/e/0/e080f7d87667f8a9b860b677dae0059fbe105467.png)

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [October 18, 2023, 6:31am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/7 "2023-10-18T06:31:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [October 18, 2023, 6:41am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/8 "2023-10-18T06:41:49Z")

</div>

> [@disberd](#):
>
> so that it can be potentially used as an alternative to PlotlyBase/PlotlyJS with the same syntax

Please let me know, as soon as this is possible I would like to test your package,  
what about, the feature [toggleitem](https://discourse.julialang.org/t/legend-groupclick-toggleitem-doesnt-seem-to-work-in-plotlyjs/76851/5), does your package support this feature?

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [October 18, 2023, 9:17am UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/9 "2023-10-18T09:17:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [March 5, 2024, 5:54pm UTC](https://discourse.julialang.org/t/cannot-use-plotlyjs/105057/10 "2024-03-05T17:54:41Z")

</div>

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](https://github.com/JuliaPlots/PlotlyJS.jl/issues/473#issuecomment-1979300463) github comment for more details.
