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)
But doing it this one shows them one below the other, as seperate plots.
A Plot is only displayed when returned (a semicolon will suppress the return), or if explicitly displayed with display(plt) , gui() , or by adding show = true to your plot command.
If you want to be more precise with how you draw vertical lines, just do it yourself with the normal :path seriestype and separate each line segment with a NaN. For future reference, the command is: vline([1,2,3]) # vertical lines at x = 1, 2 and 3.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With