Here’s a code snippet that created a scatterplot and adds marginal histograms.
using Distributions, Plots, Measures, LaTeXStrings
# set nice fonts and defaults
default(fontfamily = "Computer Modern",titlefont = (14), legend=false,
guidefont = (14, :darkgreen), tickfont = (12, :black),
framestyle = :box, yminorgrid = true, xminorgrid= true,
margin=1Measures.mm, dpi=218)
x, y = rand(Normal(), 1000), rand(Normal(), 1000)
layout = @layout [a _
b{0.75w,0.75h} c]
plot(layout = layout, link = :both, size = (600, 600))
scatter!(x,y, subplot = 2, framestyle = :box,
xlims=(-5,5), ylims=(-5,5), alpha=0.25,
xlabel=L"\Delta x\,\mathrm{(m)}", ylabel=L"\Delta y\,\mathrm{(m)}")
histogram!([x y], subplot = [1 3], orientation = [:v :h],
framestyle = :none, legend=false, bins=-5:0.25:5,
margin=-12mm, color= :green, alpha=0.5)
Here’s the output: