I have what I think is a very basic question about plotting using Cairo Makie. How can I make two plots I’m making have the same x axis range?. Here’s a working prototype that I think illustrates what I need:
using CairoMakie
f1 = Figure();
Axis(f1[1, 1], title = "Site 1")
d₀ = density!(randn(200))
d₁ = density!(1 .+ randn(200))
f1
f2 = Figure();
Axis(f2[1, 1], title = "Site 2")
d₀ = density!( 1.2 .* randn(200))
d₁ = density!(1.2 .+ 1.2 .* randn(200))
f2
If you run this code, you will see that both graphs end up with their own separate x-range. How can I format the figures so that only a certain range, say in my example, the range (-2,2) is shown in both figures?
To add to this, linkaxes! is just for making it convenient to automatically compute and synchronize limits across axes. If you want to set specific limits anyway, you don’t profit from linking and you’re fine using xlims!, ylims! or limits!, respectively. It makes a difference when interacting with figures, but since you use CairoMakie that doesn’t factor into it.