# How to change imputs in PyPlot for Plots or GR

**URL:** <https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543>\
**Category:** General Usage\
**Created:** [October 19, 2017, 12:52am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543 "2017-10-19T00:52:50Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 12:52am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/1 "2017-10-19T00:52:50Z")

</div>

In windows, PyPlot does not work and i do not know how to fix it …

so, i want to use Plots or GR to plot some data.

i have 2 examples working in PyPlot … can someone help me to translate into GR or Plots ?  
I use plot and plot! and did not solve it

1. dados = readdlm(“dados.txt”)

> ```
> plot(dados[:,1],dados[:,2])
> title("Dados")
> xlabel("R")
> ylabel("VT")
> grid()
> 
> ```

## dados is a table of 2 lines and 2 coluns …

other example is

1. 

```
          > figure(13)

```

> ```
> plot(g->dΩ12(g), 0, 2,N=600)
> title(L"$d\Omega$")
> xlabel(L"g")
> ylabel(L"$d\Omega$")
> grid()
> 
> ```

thanks for all

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [October 19, 2017, 11:23am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/2 "2017-10-19T11:23:18Z")

</div>

There is a bug in GR, but …

```julia
using GR
...
xlabel("R")
ylabel("VT")
plot(dados[:,1],dados[:,2], title="Dados")

```

… should work.

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 3:12pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/3 "2017-10-19T15:12:07Z")

</div>

and how i change the other plot ?

why is a bug in GR ? should i use Plots ?

---

<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:** [October 19, 2017, 3:43pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/4 "2017-10-19T15:43:34Z")

</div>

> [@leaoshark](#):
>
> In windows, PyPlot does not work and i do not know how to fix it …

```julia
Pkg.pin("PyPlot",v"v2.3.1")
ENV["PYTHON"]=""
Pkg.build("PyCall")

```

should do it.

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 5:51pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/5 "2017-10-19T17:51:31Z")

</div>

> [@ChrisRackauckas](#):
>
> Pkg.pin(“PyPlot”,v"v2.3.1")  
> ENV[“PYTHON”]=“”  
> Pkg.build(“PyCall”)

using PyPlot  
t=0.1:0.1:2pi  
s=sin(t)  
plot(t,s)  
1-element Array{PyCall.PyObject,1}:  
PyObject \<matplotlib.lines.Line2D object at 0x000000002A3C8CC0\>

does not work

---

<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:** [October 19, 2017, 6:19pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/6 "2017-10-19T18:19:19Z")

</div>

> [@leaoshark](#):
>
> PyObject \<matplotlib.lines.Line2D object at 0x000000002A3C8CC0\>

That means it’s working, but it’s just not opening the gui. Try using `gui()` after that? What IDE are you using?

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 6:26pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/7 "2017-10-19T18:26:00Z")

</div>

i am in windows 10 x64 and using atom x64 and julia 6

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 6:28pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/8 "2017-10-19T18:28:27Z")

</div>

i try to use this command lines in julia terminal

should i put it in atom ?

using PyPlot  
t=0.1:0.1:2pi  
s=sin(t)  
plot(t,s)  
gui()

???

---

<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:** [October 19, 2017, 7:11pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/9 "2017-10-19T19:11:34Z")

</div>

Oh, I thought you were using it as a Plots.jl backend. I’m not sure that PyPlot directly works with the Juno plot pane. I would do this:

```julia
using Plots; pyplot()
t=0.1:0.1:2pi
s=sin(t)
plot(t,s)

```

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 8:22pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/10 "2017-10-19T20:22:11Z")

</div>

> C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure  
> "matplotlib is currently using a non-GUI backend, "

this is the error

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 19, 2017, 8:22pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/11 "2017-10-19T20:22:24Z")

</div>

in julia terminal

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [October 19, 2017, 9:04pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/12 "2017-10-19T21:04:24Z")

</div>

You can set a gui backend for pyplot via `pygui(gui)` where `gui` can be one of :tk, :gtk3, :gtk, :qt5, :qt4, :qt, or :wx (try `:qt5` or `:tk`).

---

<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:** [October 19, 2017, 9:36pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/13 "2017-10-19T21:36:41Z")

</div>

> [@leaoshark](#):
>
> this is the error

Huh, I’ve only been using Atom so I haven’t checked the GUI in awhile (the plot pane works fine!). But now that I check it… I’m getting that same error. Somewhere along the way the default GUI must’ve stopped building correctly on Windows. Maybe @stevengj already knows? I don’t see an issue for this though.

> [@mkborregaard](#):
>
> You can set a gui backend for pyplot via pygui(gui) where gui can be one of :tk, :gtk3, :gtk, :qt5, :qt4, :qt, or :wx (try :qt5 or :tk).

I just ran the whole lot and none of them are working. But the plot pane through Plots.jl still works… interesting…

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 20, 2017, 2:26am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/14 "2017-10-20T02:26:04Z")

</div>

can you send me all the code for me , to put in atom ?

thanks

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [October 20, 2017, 2:26am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/15 "2017-10-20T02:26:34Z")

</div>

do you know how can i use Plots ? GR is not good for me

---

<div class="post-metadata">

**Author:** ![LotteVictor](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@LotteVictor](https://discourse.julialang.org/u/LotteVictor)\
**Post date:** [October 20, 2017, 6:13am UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/16 "2017-10-20T06:13:10Z")

</div>

I’m using Linux, but I think,as your using atom it could be similar. You can add the package Plot.jl with `Pkg.add("Plots")`. It is very useful for plotting in atom and has an extensive, very good documentation. I started using it yesterday and it’s working really well. It should have all the functionalities of PyPlot you want. The documentation is found here: [Home · Plots](http://docs.juliaplots.org/latest/)  
Hope, I could help 🙂

---

<div class="post-metadata">

**Author:** ![sashank.bhogu](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@sashank.bhogu](https://discourse.julialang.org/u/sashank.bhogu)\
**Post date:** [January 29, 2018, 1:44pm UTC](https://discourse.julialang.org/t/how-to-change-imputs-in-pyplot-for-plots-or-gr/6543/17 "2018-01-29T13:44:44Z")

</div>

In Julia, pyplot uses python’s matplotlib package to draw plots. To display plots tkinter must be installed in python. You are receiving this error message as tkinter is not installed in your python.

You can find instructions to install tkinter here:  
[http://www.greenteapress.com/thinkpython/swampy/install.html](http://www.greenteapress.com/thinkpython/swampy/install.html)

Hope this resolves.
