# Displaying multiple plots at the same time

**URL:** https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054
**Category:** Visualization
**Tags:** question, plotting, gadfly
**Created:** [September 10, 2022, 9:08pm UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054 "2022-09-10T21:08:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)
#### Post date: [September 10, 2022, 9:08pm UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054/1 "2022-09-10T21:08:13Z")

</div>

Hi all, I was trying to plot multiple Gadfly plots and display them in two separate figures. However, only the second plot was displayed.

```julia
function draw_stuff()
  Gadfly.plot(x=[1,1,2,2],[3,4,5,6],Geom.violin)
  Gadfly.plot(x=[1,1,2,2],[3,4,5,6],Geom.line)
end

```

Do I have to explicitly put each plot in display() or is there something that I’m missing when I called the Gadfly plots?

---

<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 11, 2022, 4:57am UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054/2 "2022-09-11T04:57:42Z")

</div>

> [@neuro\_enthusiast](#):
>
> Do I have to explicitly put each plot in display()

Yes.

`plot` doesn’t display a plot by itself, it returns a `Plot` object. Those `Plot` objects automatically get displayed if they’re the return value of a REPL line or notebook cell, but not otherwise. Here, I’m assuming you’re calling `draw_stuff` on the REPL or a notebook, which will return the second line’s `Plot` object, so that’ll be the only one displayed.

You can either `display(plot(...))` or add `show = true` as an argument to the plot calls: `plot(..., show = true)`.

(All of the above is based on the general Plots.jl library - I’m assuming Gadfly also provides the same interface, at least with regard to simple things like this. )

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [September 11, 2022, 6:31am UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054/3 "2022-09-11T06:31:51Z")

</div>

Use `display(plot(...))`, or possibly `hstack`, `vstack` or `gridstack` several plots (lots of examples in the [Gadfly Gallery](http://gadflyjl.org/stable/gallery/geometries/)).

---

<div class="post-metadata">

### Author: ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)
#### Post date: [September 11, 2022, 9:37am UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054/4 "2022-09-11T09:37:04Z")

</div>

Thank you for the explanation!

---

<div class="post-metadata">

### Author: ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)
#### Post date: [September 11, 2022, 9:38am UTC](https://discourse.julialang.org/t/displaying-multiple-plots-at-the-same-time/87054/5 "2022-09-11T09:38:24Z")

</div>

Thanks for the suggestion! However, I was looking to plot in separate figures rather than in subplots, which seems to be what the stack functions do.
