Qwerty
Qwerty

Reputation: 909

How to place two plots next to each other in Julia?

I want to plot the following line plot and scatter plot side-by-side in Julia. The MWE is given below:

using Plots
x = 1:10;
y = rand(10);
plot(x, y)
scatter(x, y)

enter image description here

enter image description here

But doing it this one shows them one below the other, as seperate plots.

Upvotes: 8

Views: 3238

Answers (1)

Qwerty
Qwerty

Reputation: 909

Using layout = (1, 2) might help!

using Plots
x = 1:10;
y = rand(10);
plot1 = plot(x, y);
plot2 = scatter(x, y);
plot(plot1, plot2, layout = (1, 2), legend = false)

enter image description here

Upvotes: 11

Related Questions