How to change imputs in PyPlot for Plots or GR

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

    figure(10)

     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

          >  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

There is a bug in GR, but …

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

… should work.

1 Like

and how i change the other plot ?

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

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

should do it.

1 Like

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

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

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

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

???

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:

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

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

in julia terminal

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

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.

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

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

thanks

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

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
Hope, I could help :slight_smile:

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

Hope this resolves.