unwanted change in spacing for marginal x and y plots
Previously, the marginal y plot was closer to the main plot compared to the marginal x plot:

After this change, both the marginal plots appear to be as far from the main plot:

I also increased the distance of both plots a tiny bit over the previous max distance because I think it looks better, but happy to change that if you disagree. The improvement is clearer (but still subtle) when using axes lines and a white background:
Old max:

New max:

The failing test seems unrelated to the changes I made.
While I’m not opposed to tweaking these values, please note that the actual physical spacing in the output depends on the height and width of the whole figure, as well as anything that pushes margins, such as tick labels, legends, color bars, multi-line titles etc... it’s going to be hard to claim that one pair of values makes the spacing “equal” in more than a few specific cases ;)
I see, I tested with a few different widths initially but didn't go extreme enough to notice a difference. Just tried it with more than twice the width compared to height and I can see what you mean.
I made a new commit that normalized based on the figure size. It looks good for me, so if you like it and don't any negative implications elsewhere, I can make the change to the other three places as well and drop the previous commits.
where does the 600 come from?
That's the value I used for width and height when I optimized the distance between the margins and main plot to an arbitrary value that I thought looked good (0.012). So now it will adjust this value based on the figure size.
It doesn't look perfect and could be adjusted to account for legends changing the effective width of the plot, but the principle works. Both the plots below look good with a square 600x600, but changes differently when elongated.
Without adjustment (much different)

With adjustment (still quite even)

Rebased
Not sure how to deal with autoscaling figures since their width is not known until the fig is created, which means that the marginal plot spacing can't be calculated before the fig is created.