How to choose a plotting package?

hi
i have a look on the page :
http://julialang.org/downloads/plotting.html
and on this page also :
http://computationalnumericaljulia.com/plotting-in-julia-i/
i feel lost with all these differrent directions ?
each direction needs time and energy to be installed and to be tamed
my purpose is

  1. creating big mathematical graphics with undreds of functions curves moving in all directions
  2. creating ready-for-printing images with the material of the point 1 (for editing books)
    if i use PyPlot, i wonder, why leaving python since i have a few lights on this language
    learning somethin new like gadfly would be more exciting for me but is it rational ?
    if you can share your experience with me that should help me choosing
    thanks
    Vincent
3 Likes

I would say both of those pages are out of date. The state of the art in plotting right now in Julia is Plots.jl. You can use it with many backends, of which PyPlot is one, but others like GR and PGFPlots make publication-quality graphics too.

4 Likes

That page should have a section on Plots.jl. I’ll submit a PR.

3 Likes

thanks for the answers
i typed eaxctly what this page says :
https://juliaplots.github.io/
here is the code i tryed

Pkg.add(“Plots”)
Pkg.add(“PlotlyJS”)
using Plots
plotlyjs(size = (300,300), legend = false)

plot(rand(10,5))
plot(x = 1:10, y = rand(10))

first execution, it was very long, with lots of the to be installed
second excution, shorter ; the only thing Terminal said was :
INFO: Nothing to be done
INFO: Nothing to be done

my questions are :

  • i guess that the “Pkg.add” instructions have to be written only once, and that for the next executions i can forget them ; am i right ?
  • no graph appeared on my screen…

Vincent

  • Yes you have to excute “Pkg.add” only once.

  • there were no error messages? you need to install this once before using PlotlyJS
    but if you couldn’t draw Plot with “PlotsJS” backend even after installation, trying other backend might help.

Give the Plotly backend a try first. It’s browser-based and installs with Plots, so it should work on just about any system.

using Plots; plotly()
plot(rand(10,10))

Hi YongHee-Kim
you say i have to install this :
https: GitHub - JuliaPlots/PlotlyJS.jl: Julia library for plotting with plotly.js
i just want to be really sure of what à do because i walk blind for the moment
do i just have to do this in a julia session ?
using Blink
Blink.AtomShell.install()

Hi ChrisRackauckas
i tried your code :
using Plots; plotly()
plot(rand(10,10))

i gave nothing and produced no error either

i have done this :
using BlinkBlink.AtomShell.install()

and typed this :

using PlotlyJS
function datetimestrings()
x = [“2013-10-04 22:23:00”, “2013-11-04 22:23:00”, “2013-12-04 22:23:00”]
plot(scatter(x=x, y=[1 ,3, 6]))
end

no window with any graph appears… but no error is indicated…

Two questions then: are you using Julia v0.5? And, are you using Juno?

hi

  1. in my
    /Applicatons
    i have “Julia-0.5” installed
    i hope it is the same that julia invoke when i use julia from the terminal

  2. i dont know if it is a right idea but i am downloading uber-juno inside atom
    i will then make a trial of a simple graphic and tell you

Did you type exactly this?
If so, then the plot is never called, since you put it inside the function datetimestrings().

Just add a call to that function by now putting datetimestrings() at the end.

By the way, please “quote” code using backticks (`), e.g.

`using PlotlyJS`

or triple backticks for blocks of code.

Hi Dpsanders
so stupid from me…
now, i have typed :

using PlotlyJS
function datetimestrings()
    x = ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"]
    plot(scatter(x=x, y=[1 ,3, 6]))
end
datetimestrings()

the result is the same : nothing…

Hi Christopher
i have just created a new julia file from Atom (after havind installed uber juno in Atom)
in this new file i have typed this minimal sample of code :

using PlotlyJS
function datetimestrings()
    x = ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"]
    plot(scatter(x=x, y=[1 ,3, 6]))
end
datetimestrings()

then i have clicked on “Run File” in the Julia menu of Atom

result : nothing happens…

Hello,
I can reproduce the problem. It works fine in the terminal, though.
That means, it is a problem of Atom/ Juno.
Uwe

I found the reason. It works in the console, but in a script you have to write
display(datetimestrings())

as last line, because the return value of a script is not displayed by default.
This should be changed in Atom/ Juno because it is inconsistent and confusing.

Uwe

I would recommend that you use Plots.jl instead of using PlotlyJS directly.
I could not get Run file to work in Atom, but highlighting the following code (which uses Plots.jl) and pressing Shift-enter worked for me:

using Plots
plotlyjs()

function datetimestrings()
    x = ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"]
    plot(x, [1 ,3, 6])
end

datetimestrings()

I had to open the Plots panel by hand, too. (Command-J command-P on a Mac)

Should be fixed with
https://github.com/JunoLab/Atom.jl/pull/76

I don’t find this behaviour to be hugely useful, but it is consistent with include() at the REPL. And it seems to have caused some confusion here, so it’s probably a good idea anyways :wink:

Edit: As per @MikeInnes’ comment in that PR, this behaviour doesn’t seem very beneficial. If you want to voice any opinions on that, please do so there.

hi Uwe
you say it works for you from the terminal
i typed this code in a .jl file that i invoked from the terminal typing : julia [pathofthefile]
result : now something new happens, a window opens
but the window is empty
i tried other lines of code to see :

function contour1()
    x = y = [-2*pi + 4*pi*i/100 for i in 1:100]
    z = [sin(x[i]) * cos(y[j]) * sin(x[i]*x[i]+y[j]*y[j])/log(x[i]*x[i]+y[j]*y[j]+1)
         for i in 1:100 for j in 1:100]
    z_ = [z[i:i+99] for i in 1:100:10000]
    data = contour(;z=z_, x=x, y=y)
    plot(data)
end
display(contour1())

idem, an empty window appears
Vincent

thank you Uwe
the consequence of having typed display(thing()) for me is the apparition of this windows that unfortunately stays empty
your words about Atom/Juno seem to mean that it is not a good idea to use it ?
Vincent