# Efficient link all x-axis for updating limits and zooming in x direction

**URL:** <https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288>\
**Category:** Visualization\
**Tags:** question, makie\
**Created:** [April 10, 2022, 8:01am UTC](https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288 "2022-04-10T08:01:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [April 10, 2022, 8:01am UTC](https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288/1 "2022-04-10T08:01:56Z")

</div>

I am making an interactive app that has some series of axis with the same x axis. For efficiency reasons, I am linking the x-axes, so that I only update the x limits of one axis. I’ve noticed, with the way I do it now (see MWE below), when I zoom into one axis, only the axis I zoom, and the last one (where I link everything to) are updated, while the rest are static. What is the best way to couple things, so that when I zoom to _any_ axis, all axis reflect the zoom in the x-axis?

```julia
using GLMakie
idxs = 5
fig = Figure()
axs = []
for i in 1:idxs
    ax = Axis(fig[i,1])
    lines!(ax, rand(10), rand(10))
    push!(axs, ax)
end
for i in 1:idxs-1
    linkxaxes!(axs[i], axs[end])
    hidexdecorations!(axs[i]; grid = false)
end

display(fig)

```

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [April 10, 2022, 8:02am UTC](https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288/2 "2022-04-10T08:02:19Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/d/3/d3d6d750a94a1c2818a04239c09ed458eb311746.png)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [April 10, 2022, 10:57am UTC](https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288/3 "2022-04-10T10:57:41Z")

</div>

It should just work, seems this has become buggy at some point? Is it the same with `linkxaxes!(all_axes...)`?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [January 29, 2025, 4:46pm UTC](https://discourse.julialang.org/t/efficient-link-all-x-axis-for-updating-limits-and-zooming-in-x-direction/79288/4 "2025-01-29T16:46:53Z")

</div>

Given a `Figure`, what is the most up-to-date method to retrieve the list of axis and link all? I am using the following code:

```julia
linkaxes!(fig.content...)

```

Is there a better way? Will the `fig.content` always store `Axis` objects?
