PyPlot plot window does not pop up in Atom

I am using Julia 1.0.0 and PyPlot for plotting. My problem is that when I run PyPlot.plot() from Atom the plot window does not pop up (this has worked before, but it doesn’t work currently). However, plotting figures using PyPlot works fine if I use the command line version of Julia or the Jupyter notebook. So I guess I have made some strange changes to Atom such that PyPlot doesn’t work. Any ideas on what the problem can be?

Uncheck the Enable Plot Pane option in the julia-client settings in Atom:
image

You’ll probably have to restart Julia afterwards.

1 Like

Thanks! The plot window pops up now :slight_smile:

If you want to display your PyPlot plots in Atom with Juno (without changing the settings), you could also add

gcf()

at the end of your plotting code. As mentioned in PyPlot cannot be used in Juno, stopped by @zhangliye.

Additionally, clf() is also useful to clear the plot.

8 Likes

One way to achieve the Window without disabling the Plots Pane is by setting pygui(true).

something like:

using PyPlot
pygui(true)
# use x = linspace(0,2*pi,1000) in Julia 0.6
x = range(0; stop=2*pi, length=1000); y = sin.(3 * x + 4 * cos.(2 * x));
plot(x, y, color="red", linewidth=2.0, linestyle="--")
title("A sinusoidally modulated sinusoid")

Will make the window pop up in Juno.