# Transpose Plot Layout

**URL:** <https://discourse.julialang.org/t/transpose-plot-layout/69267>\
**Category:** General Usage\
**Tags:** plotting, plots\
**Created:** [October 5, 2021, 9:54pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267 "2021-10-05T21:54:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [October 5, 2021, 9:54pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267/1 "2021-10-05T21:54:12Z")

</div>

I am using Plots for plotting and tried out subplots today. I wanted to plot 4 rows of plots and 2 columns. The code I am using is:

```julia
    # plot data    
    p = Array{Plots.Plot}(undef, 8)
    n = 0	
    for i = 1:8
        data = rand(10)
        print("Plot $i \r")
        p[i] = plot(data, title="chan $i", ylabel="Amplitude", xlabel="Time [s]", legend=false)
    end
    plot(p..., layout = (4,2), legend=false) |> display

```

When I change the layout = (4,2) to layout = (2,4) the plot layout does not change. Is there something I am missing?

---

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [October 5, 2021, 9:57pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267/2 "2021-10-05T21:57:18Z")

</div>

I now see what is going on. The plot on my screen does not change but when I do a savefig, it does change.

The result for layout = (4,2) is

![plot4_2](https://global.discourse-cdn.com/julialang/original/3X/5/b/5bbc703a33242239533f2df28f61af92c86b692e.png)

and the result for layout = (2,4) is

![plot2_4](https://global.discourse-cdn.com/julialang/original/3X/9/0/90a37aa64f5408d1d4411fb312ef7d4bf871f982.png)

I figured it out in generating the plots for this question, and then thought it worth sharing since it is not obvious the first time through.

---

<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 5, 2021, 10:37pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267/3 "2021-10-05T22:37:43Z")

</div>

Fyi, the display is working just fine in Plots v1.22.4 with default gr() backend (GKS QtTerm plot window).

---

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [October 8, 2021, 3:19pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267/4 "2021-10-08T15:19:57Z")

</div>

It indeed looks nice. In my plotting I would like to open 3 separate plot windows when I run the program. Inspectdr() does that part nicely but gr() just overwrites the previous plots. It is a large dataset so the backend needs to handle many points.
