# How to Fix Plot GUI/WIndow not showing again / Anymore?

**URL:** <https://discourse.julialang.org/t/how-to-fix-plot-gui-window-not-showing-again-anymore/87209>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [September 13, 2022, 12:05pm UTC](https://discourse.julialang.org/t/how-to-fix-plot-gui-window-not-showing-again-anymore/87209 "2022-09-13T12:05:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [September 13, 2022, 12:05pm UTC](https://discourse.julialang.org/t/how-to-fix-plot-gui-window-not-showing-again-anymore/87209/1 "2022-09-13T12:05:17Z")

</div>

I have a problem, probably due to plotting a lot of graphs. I can’t plot anymore. Either using pyplot() or gr() as backend the plot window / gui does not comes out, I try with working codes and the window never shown again, but on REPL the codes run.

What to do to fix the plotting GUI/window problem? (I suspect this is due to the plot of step function I tried tremendously yesterday `[x + 1/2]`

This is the problematic codes:

```julia
using Plots, LaTeXStrings, Plots.PlotMeasures
pyplot()

f(x) = floor(x + 1/2)
x = -5.5:1:4.5
y = f.(x)

plot(x[1:2], [y[1], y[1]], label=L"f(x) = \lfloor x + 1/2 \rfloor", legend=:bottomleft,legend_foreground_color=:white,
legend_font_color=:blue, color=:blue, showaxis=false, tickfontcolor=:white)

# axis
hline!((0,0), color=:black, label="")
vline!((0,0), color=:black, label="")

# Scale values
for i in x
	if i!= 0
		annotate!(i,-0.2, (i, 7))
	end
end

for i in y
	if i != 0
		annotate!(-.2, i, (i, 7))
	end
end

annotate!(-.2, -.2, ("0", 7))

# Plot function
for i in 2:length(x)-1
	plot!(x[i:i+1], [y[i], y[i]], label="", color=:blue, lw=2)
end

```

The codes run without error or warning but the GUI/window is not showing (attachment below):

![Capture d’écran_2022-09-13_15-43-49](https://global.discourse-cdn.com/julialang/original/3X/7/c/7c7ac40cb8ef195e8318bfac3bacd37b0b3734c1.png)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 13, 2022, 12:36pm UTC](https://discourse.julialang.org/t/how-to-fix-plot-gui-window-not-showing-again-anymore/87209/2 "2022-09-13T12:36:45Z")

</div>

> [@Freya\_the\_Goddess](#):
>
> I have a problem, probably due to plotting a lot of graphs

Yes you’re correct - there’s a limited number of plots you can do with Julia (I think it’s around 13,500), and once you reached that you need to re-install Julia on a different computer.

No just kidding you can plot as much as you want **but** you do need to understand that plots are only displayed if you’re evaluating an expression which returns a plot object. When you do

```julia
for i in something
    plot(i)
end

```

the return value is `nothing`, as that’s what all loops in Julia return. You need to either

1. Create an explicit plot object `p = plot()` before the loop and then call it after; or
2. Call `current()` if you want to display the current plot object (the last one plotted to)

This isn’t unique to plots btw, here’s how integers behave:

```julia
julia> 2
2

julia> for i ∈ 1:10
           2
       end

julia>

```

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [September 14, 2022, 12:05pm UTC](https://discourse.julialang.org/t/how-to-fix-plot-gui-window-not-showing-again-anymore/87209/3 "2022-09-14T12:05:38Z")

</div>

> [@nilshg](#):
>
> there’s a limited number of plots you can do with Julia (I think it’s around 13,500), and once you reached that you need to re-install Julia on a different computer.

* * *

**ERROR** : You have reached the maximum amount of plots allowed in the Julia Base version. Please purchase the _LotsOfPlots_ expansion pack to be able to plot more.

* * *

(Also just a joke.)

For the original issue, two more options are:

- add a `show = true` argument to your first `plot` call
- call `gui()` at the end of the script
