# How layout scatter plots on a grid layout?

**URL:** <https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601>\
**Category:** New to Julia\
**Tags:** plotting, plots, layout-plots\
**Created:** [June 24, 2019, 12:31pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601 "2019-06-24T12:31:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [June 24, 2019, 12:31pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/1 "2019-06-24T12:31:53Z")

</div>

Say I have 3 scatter plots and I want to lay them out in a 3 by 1 grid. How do I achiege that with Plots.jl?

The `@layout` only shows examples of random data, but if I want to do it using specified plots e.g.

```julia
x = rand(10)
y = rand(10)
z = rand(10)

l = @layout grid[1,3]

# how to put these in one plot?
scatter(x,y)
scatter(x,z)
scatter(y,z)

```

---

<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:** [June 24, 2019, 12:36pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/2 "2019-06-24T12:36:36Z")

</div>

`scatter(rand(10,3), layout=3)`?

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [June 24, 2019, 12:37pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/3 "2019-06-24T12:37:48Z")

</div>

> [@nilshg](#):
>
> rand(10,3)

This is the problem. My `x` and `y` and `z` aren’t actually random. How do I do it? Do I have to put them in a matrix? Or I can produce 3 plots, and then say, this one goes here and this is next … and lay them out.

Also the results don’t look right anyway.

---

<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:** [June 24, 2019, 12:40pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/4 "2019-06-24T12:40:17Z")

</div>

Ah sorry I didn’t properly read your post:

```julia
x = rand(10)
y = rand(10)
z = rand(10)

p1 = scatter(x, y)
p2 = scatter(x, z)

plot(p1, p2)

```

should be what you’re looking for

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [June 24, 2019, 12:41pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/5 "2019-06-24T12:41:10Z")

</div>

Figured it out

```julia
plot(scatter(x,y), scatter(x,z), scatter(y,z), layout = @layout grid(1,3))

```

---

<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:** [June 24, 2019, 12:42pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601/6 "2019-06-24T12:42:24Z")

</div>

Yes or that - check out the Magic Grid Argument example in the docs [here](http://docs.juliaplots.org/latest/examples/gr/), which includes a ton of tuning options for collections of plots as subplots.
