Thanks Rafael, indeed this could serve me as a workaround now but seems I do need to switch to Makie
on the long run. In particular I noticed that a combination of bottom_margin and top_margin can remove the separation entirely, but the final result changes depending on the precise margins used. For instance, the following
using Plots
xvals = rand(10)
yvals = rand(10)
l = @layout [a{0.3h}
b]
p1 = plot(xvals,yvals,xformatter=Returns(""))
p2 = plot(xvals,yvals,xformatter=Returns(""))
plot(p2,p1,layout=l, grid=false, bottom_margin = [-20mm 0mm], top_margin = [0mm -20mm])
savefig("example.png")
p1 = plot(xvals,yvals,xformatter=Returns(""))
p2 = plot(xvals,yvals,xformatter=Returns(""))
plot(p2,p1,layout=l, grid=false, bottom_margin = [-5mm 0mm], top_margin = [0mm -5mm])
savefig("example2.png")
Produces these two
the difference is small, it just modified the relative sizes of each panel, which in this case can work. But I can see how difficult this will be to handle with multi-panel situations where precise sizing is a must. I also noticed that for some reason this becomes very finicky if I combine it with twinx()
.
My minor grievance with Makie
is that it does not allow to plot ticks on all four sides, which I can do in Plots
by abusing twinx()
and twiny()
.