# Create two unrelated plots in one script

**URL:** https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426
**Category:** Visualization
**Created:** [November 19, 2016, 3:50am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426 "2016-11-19T03:50:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ArchieCall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/archiecall/32/206_2.png) [@ArchieCall](https://discourse.julialang.org/u/ArchieCall)
#### Post date: [November 19, 2016, 3:50am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/1 "2016-11-19T03:50:24Z")

</div>

The following script generates two unrelated plots that I desire to place into one plot pane, or possibly two plot panes. I do not want them to lay on top of each other because they are unrelated ie. (sub plots will not work).

My environment is: Windows, Atom, Plots, and plotlyjs.

```julia
using Plots
plotlyjs()
plot(Plots.fakedata(50,5),w=3, show = true)
sleep(20.)
plot([sin,cos], 0, 2*π, show = true)
gui()

```

I have tried all kinds combinations to get the two plots in one gui() window, or one plot in each of two gui() windows. As I recall from R, and RStudio you could name your plot panes and put a separate plot in each one. I tried this in Julia, but it does not seem to work. In my example script above the the second plot replaces the first plot after 20 seconds which is strictly a work around.

Can anyone provide input on how this might be accomplished…Thanks Archie

---

<div class="post-metadata">

### Author: ![tbreloff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbreloff/32/68_2.png) [@tbreloff](https://discourse.julialang.org/u/tbreloff)
#### Post date: [November 19, 2016, 4:06am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/2 "2016-11-19T04:06:04Z")

</div>

I’m a little confused. You want them next to each other, but you don’t want them next to each other. Which is it? Fyi you can put them stacked or side by side even if they’re completely unrelated. Just `plot(p1, p2)`

---

<div class="post-metadata">

### Author: ![tbreloff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbreloff/32/68_2.png) [@tbreloff](https://discourse.julialang.org/u/tbreloff)
#### Post date: [November 19, 2016, 4:08am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/3 "2016-11-19T04:08:08Z")

</div>

Also `reuse = false` should bring up a second window if thats what you wanted.

---

<div class="post-metadata">

### Author: ![ArchieCall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/archiecall/32/206_2.png) [@ArchieCall](https://discourse.julialang.org/u/ArchieCall)
#### Post date: [November 19, 2016, 4:21am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/4 "2016-11-19T04:21:06Z")

</div>

I do not want them side by side. It looked like if the use Sub Plots in a  
vertical fashion it used a common X Axis which will not work because the  
plots are unrelated…Archie

---

<div class="post-metadata">

### Author: ![ArchieCall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/archiecall/32/206_2.png) [@ArchieCall](https://discourse.julialang.org/u/ArchieCall)
#### Post date: [November 19, 2016, 4:21am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/5 "2016-11-19T04:21:57Z")

</div>

I will try reuse = false and get back to you…Thanks…Archie

---

<div class="post-metadata">

### Author: ![tbreloff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbreloff/32/68_2.png) [@tbreloff](https://discourse.julialang.org/u/tbreloff)
#### Post date: [November 19, 2016, 4:26am UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/6 "2016-11-19T04:26:20Z")

</div>

No only if you link the axes. Should work fine for you.

---

<div class="post-metadata">

### Author: ![ArchieCall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/archiecall/32/206_2.png) [@ArchieCall](https://discourse.julialang.org/u/ArchieCall)
#### Post date: [November 19, 2016, 12:19pm UTC](https://discourse.julialang.org/t/create-two-unrelated-plots-in-one-script/426/7 "2016-11-19T12:19:09Z")

</div>

This works but I’m having a difficult time placing the individual legends on each plot. I will go back to only having one plot per script. Thanks for helping.
