Plotly in Julia - Questions

Hi community,

I’m re-starting my Julia journey since at work we have a toy project with it.

I have a question regarding the use of Plotly in Julia, since it is the graphing library I mostly use in Python:

  • What is the best way to use Plotly in Julia? With PlotlyJS.jl? The information is very confusing to be honest.
  • Can we in Julia use the full potential of plotly.js?
  • Is there anywhere to find a recent tutorial on it? Everything I find is pretty old and seems outdated.

What I would like is interactive graphs:

  • Zoom in/out.
  • Selection/deselection of variables.
  • cross-hair
  • etc.

Thanks all for your support!

PlotlyJS.jl works without issues for me. The documentation should get you started. If you are already using it in python, then I think you’ll quickly learn the julia way based on the examples in the docs.

The other source of information is plotly’s documentation itself. You can switch between different languages so you can search for familiar python code and see how that looks in julia.

I think what you want, will work in julia seamlessly. I’m using plotly’s Dash for dashboards as well and that required more effort, but since I’ve figured it out, works without issues.

2 Likes

Thanks @cserteGT3 for the useful information, I did not know about that documentation (Home · PlotlyJS). I will try to replicate one of the plots I recently made with Python.

One question, does using PlotlyJS.jl take all the up to date functionality of plotly.js as the latter is being updated? I see that PlotlyJS.jl has not being updated in a while, that’s why.

Thanks!

You may also be interested by PlotlyLight.jl.

4 Likes

Very interesting @Maucejo, it uses directly the Plotly.js documentation. Will also take a look at it.

(Homework is accumulating here!)

thanks!

If you want to use Plotly in a reactive notebook developed for Julia, Pluto.jl, the best option is to use PlutoPlotly.jl. PlutoPlotly is a wrapper for Plotly and works immaculately. I have used it in my teaching (which involves a lot of plotting) over the last five years, and I have no regrets.

2 Likes

I used to use PlotlyJS a lot. But: the time to first plot can be atrociously long (Blink, probably). I love PlotlyLight.jl. Light and quick.

2 Likes

Ok, now I’m a little lost, can’t I use PlotlyLight.jl for example in Pluto,jl?
So far I’ve been directed to 3 different Plotly libraries:

This is getting a little out of hand :sweat_smile:

In VScode, you can use PlotlyJS.jl and PlotlyLight.jl at your discretion, but (as far as I know) PlutoPlotly.jl is not yet possible. The leading developer of PlutoPlotly.jl (@disberd) initially mentioned the intention to make it also available for VScode, but I am unsure if that integration has been finished or abandoned for some reason.

In Pluto, you can use PlotlyJS.jl (or use PlotlyBase.jl instead because this is the actual plot-making engine of PlotlyJS.jl) or PlutoPlotly.jl, but not PlotlyLight.jl (as far as I can tell) . The integration of Plotly plotting capabilities into Pluto, done with PlutoPlotly, works much better than with PlotlyBase.jl because the maintenance of PlotlyBase.jl and PlotlyJS.jl is not done regularly.

Some packages work in one IDE and not in others, and this is not a problem exclusive to Julia users. For example, in Python, some plotting packages work well in some IDEs and not in others. Recently, I had to wait several months for the Lets-Plot.py package to run successfully in one Python reactive notebook. It is something we have to accept when we are using free-of-charge software. In fact, it is remarkable that we have many different possibilities to choose from, and we do not have to pay a penny to satisfy our choices.

2 Likes

Thanks @VivMendes . I will definitely use Pluto.jl ande VScode, so I will have to figure out what to use.
I was hoping to use only 1 package for plotting based on plotly.js but ,unexpectedly, it might be more convoluted than expected.
Thanks!

1 Like

If you want to use Plotly’s plotting capabilities in Julia, you will not face any problems, and there will be no convolutions at all.

If you need to use VScode, install PlotlyJS.jl in your environment, and the code will run. If, instead, you want to use Pluto.jl, just type in one cell of your notebook using PlutoPlotly, and the code will run. Exactly the same code! (well, apart from the begin ... end block boring part of Pluto).

PlotlyJS and PlutoPlotly are wrappers of the same Plotly package, so the same code works in both IDEs. The only difference (if I am not wrong) is related to using LaTeX code in the plots. Here, PlutoPlotly works better because @disberd introduced some useful tricks in his package.

1 Like

Perfect, now it is clear! Thanks!