# How to choose a plotting package?

**URL:** <https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134>\
**Category:** New to Julia\
**Tags:** question, plotting\
**Created:** [December 24, 2016, 10:45am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134 "2016-12-24T10:45:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 24, 2016, 10:45am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/1 "2016-12-24T10:45:43Z")

</div>

hi  
i have a look on the page :  
[http://julialang.org/downloads/plotting.html](http://julialang.org/downloads/plotting.html)  
and on this page also :  
[http://computationalnumericaljulia.com/plotting-in-julia-i/](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

---

<div class="post-metadata">

**Author:** ![swt30](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swt30/32/4667_2.png) [@swt30](https://discourse.julialang.org/u/swt30)\
**Post date:** [December 24, 2016, 11:08am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/2 "2016-12-24T11:08:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 24, 2016, 4:25pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/3 "2016-12-24T16:25:31Z")

</div>

> [@vincent](#):
>
> i have a look on the page : [http://julialang.org/downloads/plotting.html](http://julialang.org/downloads/plotting.html)

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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 24, 2016, 9:42pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/4 "2016-12-24T21:42:33Z")

</div>

thanks for the answers  
i typed eaxctly what this page says :  
[https://juliaplots.github.io/](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

---

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [December 24, 2016, 10:22pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/5 "2016-12-24T22:22:46Z")

</div>

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

- there were no error messages? you need to [install this](https://github.com/spencerlyon2/PlotlyJS.jl) once before using PlotlyJS  
but if you couldn’t draw Plot with “PlotsJS” backend even after installation, trying [other backend](https://juliaplots.github.io/backends/) might help.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 24, 2016, 10:29pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/6 "2016-12-24T22:29:20Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 25, 2016, 10:50am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/7 "2016-12-25T10:50:40Z")

</div>

Hi YongHee-Kim  
you say i have to install this :  
https: [GitHub - JuliaPlots/PlotlyJS.jl: Julia library for plotting with plotly.js](http://github.com/spencerlyon2/PlotlyJS.jl)  
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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 25, 2016, 7:51pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/8 "2016-12-25T19:51:10Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 25, 2016, 7:54pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/9 "2016-12-25T19:54:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 25, 2016, 8:29pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/10 "2016-12-25T20:29:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 25, 2016, 10:37pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/11 "2016-12-25T22:37:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 25, 2016, 10:38pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/12 "2016-12-25T22:38:39Z")

</div>

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

``using PlotlyJS``

or triple backticks for blocks of code.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 26, 2016, 6:59am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/13 "2016-12-26T06:59:56Z")

</div>

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

```julia
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…

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 26, 2016, 7:02am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/14 "2016-12-26T07:02:40Z")

</div>

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 :

```julia
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…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 26, 2016, 7:15am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/15 "2016-12-26T07:15:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 26, 2016, 7:26am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/16 "2016-12-26T07:26:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 26, 2016, 7:58am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/17 "2016-12-26T07:58:18Z")

</div>

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:

```julia
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)

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [December 26, 2016, 11:06am UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/18 "2016-12-26T11:06:29Z")

</div>

Should be fixed with  
[https://github.com/JunoLab/Atom.jl/pull/76](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 😉

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.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 27, 2016, 12:36pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/19 "2016-12-27T12:36:41Z")

</div>

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 :

```nohighlight
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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vincent/32/380_2.png) [@vincent](https://discourse.julialang.org/u/vincent)\
**Post date:** [December 27, 2016, 12:49pm UTC](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134/20 "2016-12-27T12:49:17Z")

</div>

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

[Next page](https://discourse.julialang.org/t/how-to-choose-a-plotting-package/1134.md?page=2)
