Subplots and axis labels

I’ve been using Plots.jl for some time, but never managed to figure out the correct way of producing a figure with subplots and axis labels. In most cases, it seems axis labels are positioned outside of the plot area, and when joining the figures these get cut out.

MWE:

function plot_bug()
    xs = [0, 1]
    p1 = plot(xs, xs, xlabel="x1", ylabel="y1", title="A")
    p2 = plot(xs, 1 .- xs, xlabel="x2", ylabel="y2", title="B")
    p = plot(p1, p2, layout=(1,2), size=(1300,400))
    savefig(p, "bug.pdf")
end

Result:

Removing the size directive “fixes” the labeling, but then the figure would not be in the correct scaling for what I need.

NB: I have seen suggestions of explicitly setting margins and using Plots.mm. While this could work, I find it very unnatural. How could the user correctly know how much space is needed for labels etc? The plotting engine knows the figure size, the box width of the labels, of the axis, … So the solution seems to be done on a “case by case basis”, and lose uniformity (since the margins will be adjusted by looking at the rendered graph, not by looking at the box sizes as the backend could do)