title: How to fix aspect ratio with linked axes?
body: <p>I'm trying to make a scatterplot with marginal density, and have the scatterplot have fixed x and y limits with an aspect ratio equal to 1. However, I can't seem to find a combination of axis linking, axis limits, and colsize that fits this.</p>
  <p>This is close, but note that the scatter plot does not have equal axes:</p>
  <pre><code>using CairoMakie
  
  n = 3000
  r = randn(2,3000)
  x = @view r[1,:]
  y = @view r[2,:]
  
  fig = Figure(resolution = (1000, 1000), font = &quot;sans&quot;, fontsize = 20)
  ax1 = (Axis(fig[1, 1]))
  density!(ax1, y; bins = 20, color = :orange, strokewidth = 1,
      strokecolor = :black, label = &quot;20 bins&quot;, aspect=1)
  
  ax3 = Axis(fig[2, 1]; xlabel = &quot;value&quot;, ylabel = &quot;counts&quot;)
  ax4 = Axis(fig[2, 2]; xlabel = &quot;value&quot;, ylabel = &quot;counts&quot;)
  scatter!(ax3, x, y; markersize = 4, color = :black,label=&quot;samples&quot;)
  axislegend(ax3; position = :rt)
  
  density!(ax4, x; label = &quot;default&quot;,direction=:y)
  rowsize!(fig.layout, 2, Auto(3))
  colsize!(fig.layout, 1, Auto(3))
  xlims!(ax3,-4,4)
  ylims!(ax3,-4,4)
  linkxaxes!(ax1, ax3)
  linkyaxes!(ax3, ax4)
  
  
  fig
  </code></pre>
  <p>Produces:</p>
  <p><a href="https://i.stack.imgur.com/rCHBb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rCHBb.png" alt="enter image description here" /></a></p>
  <p>This is a followup question from this post: <a href="https://stackoverflow.com/questions/73286332/change-the-size-of-a-sub-figure/73289633#73289633">Change the size of a sub-figure?</a></p>