# Open multiple figure windows using Plots

**URL:** <https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [July 18, 2025, 9:49pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859 "2025-07-18T21:49:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernardofpc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernardofpc/32/7783_2.png) [@bernardofpc](https://discourse.julialang.org/u/bernardofpc)\
**Post date:** [July 18, 2025, 9:49pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/1 "2025-07-18T21:49:37Z")

</div>

I would like to use scripts, in the REPL, to display multiple figures from a function. Using `PyPlot` and `plt.figure` allows it, but `Plots` does not seem to have a way of doing so.

My MWE:

```julia
using Plots
import PyPlot
plt = PyPlot

function test()
    x = 1:10
    y = rand(10)

    p = plot(title="Sample Plot, does not appear")
    plot!(p, x, y, label="Random Data")
    display(p) # Very weird that this does nothing!

    p2 = plot(title="Another Sample Plot", reuse=false)
    plot!(p2, x.^2, sqrt.(y), label="More Random Data")
    display(p2) # Only this one appears

    nothing
end

function test_plt()
    x = 1:10
    y = rand(10)

    plt.figure()
    plt.plot(x, y, label="Random Data")
    plt.title("Sample Plot with PyPlot")
    plt.legend()

    plt.figure()
    plt.plot(x.^2, sqrt.(y), label="More Random Data")
    plt.title("Another Sample Plot with PyPlot")
    plt.legend()

    nothing
end

test()
test_plt()

```

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [July 18, 2025, 10:28pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/2 "2025-07-18T22:28:03Z")

</div>

This is a backend issue with Plots when using the GRBackend. Depending on OS and perhaps versions, this _might_ work (didn’t for me)

```julia
ENV["GKSwstype"] = "100" # forces GR to use a GUI window
using Plots
gr() # explicitly set backend

```

Even setting `reuse=false` didn’t work for me.

---

<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:** [July 19, 2025, 3:56am UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/3 "2025-07-19T03:56:39Z")

</div>

It might work wit the PyPlot backend.

For me this issue is one of the reasons not to use Plots.jl.

I use ControlPlots.jl or GLMakie.jl .

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [July 19, 2025, 5:23am UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/4 "2025-07-19T05:23:39Z")

</div>

Please, check [this post](https://discourse.julialang.org/t/how-to-display-multiple-plot-windows/82246/2).

---

<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:** [July 19, 2025, 5:54am UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/5 "2025-07-19T05:54:57Z")

</div>

The only workaround in GR is to enter Command+F to freeze the window.

---

<div class="post-metadata">

**Author:** ![bernardofpc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernardofpc/32/7783_2.png) [@bernardofpc](https://discourse.julialang.org/u/bernardofpc)\
**Post date:** [October 8, 2025, 6:00pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/6 "2025-10-08T18:00:19Z")

</div>

So to be clear:

1. `GR` does not support multiple windows (is there a plan for this?)
2. Other backends (`pyplot`, `gaston`, …) do - so one must explicitly use them

One might wonder why `GR` is the default, then…

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 8, 2025, 6:42pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/7 "2025-10-08T18:42:48Z")

</div>

With the default Plots.jl `gr()` backend, the following works on Windows, but as indicated above, the new window is a frozen copy:

```julia-auto
using Plots; gr()
plot(sin)
# Click on the plot window to make it the main focus.
# Press the 'F' key to freeze the former plot in a new window
plot(cos)

```

---

<div class="post-metadata">

**Author:** ![bernardofpc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernardofpc/32/7783_2.png) [@bernardofpc](https://discourse.julialang.org/u/bernardofpc)\
**Post date:** [October 10, 2025, 5:18pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/8 "2025-10-10T17:18:36Z")

</div>

If I understand what you meant, then, the click then press ‘F’ must be done before the next `plot` command. This seems incompatible with the use “in a script”.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 10, 2025, 5:29pm UTC](https://discourse.julialang.org/t/open-multiple-figure-windows-using-plots/130859/9 "2025-10-10T17:29:12Z")

</div>

Yes, but if you really want to use the gr() backend, you could try simulating the key presses programmatically using the operating system APIs.
