How layout scatter plots on a grid layout?

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.

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)

scatter(rand(10,3), layout=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.

Ah sorry I didn’t properly read your post:

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

1 Like

Figured it out

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

Yes or that - check out the Magic Grid Argument example in the docs here, which includes a ton of tuning options for collections of plots as subplots.