# Makie parent/children relationships

**URL:** <https://discourse.julialang.org/t/makie-parent-children-relationships/128457>\
**Category:** Visualization\
**Tags:** makie, glmakie\
**Created:** [April 27, 2025, 7:21am UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457 "2025-04-27T07:21:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [April 27, 2025, 7:21am UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/1 "2025-04-27T07:21:19Z")

</div>

I am new to Makie, so I am still on the learning curve.  
I am trying to understand the parent/children relationships.

Assume that I have a Figure with several Axes,  
and each Axis contains several Plots.  
Assume that I have saved only the Figure object at creation,  
but neither the Axis nor the Plot objects.

I learned that I can get all axes as: `axs = fig.content`  
and any of the plots as: `plt = axs[i].scene.plots[j]`  
This is the “children” syntax.

But how can I go backwards from children to parents,  
i.e. from a given plt to ax, and from a given ax to fig?

---

<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 27, 2025, 8:41am UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/2 "2025-04-27T08:41:24Z")

</div>

Blocks like Axis have a parent field [Makie.jl/src/makielayout/blocks.jl at master · MakieOrg/Makie.jl · GitHub](https://github.com/MakieOrg/Makie.jl/blob/master/src/makielayout/blocks.jl#L20)

But from plot to Axis there’s no backlink as far as I remember, just from plot to parent Scene. But the Scene doesn’t have a reference to the Axis that owns it.

The Scene graph is the actual relevant structure for rendering, Figure and Blocks are kind of metadata objects parallel to the scene graph.

---

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [April 27, 2025, 9:10am UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/3 "2025-04-27T09:10:22Z")

</div>

Thank you very much for your informative answer!

It is good to know that `axs[i].parent == fig` already works.

It would be nice to have a similar mechanism for plots:  
`plt = axs[i].scene.plots[j]`  
`plt.parent == axs[i]`

I don’t know how difficult it would be to implement,  
but for the user it would be a very convenient mechanism.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 27, 2025, 7:24pm UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/4 "2025-04-27T19:24:17Z")

</div>

It would be fantastic to have some interface for finding parents and children, perhaps even something similar to Matlab’s `findobj`, which lets you search for eg. all line objects with the color red and a specific user tag. Its very convenient, and I haven’t found any way to replicate that functionality in Makie. Is it theoretically feasible?

---

<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 27, 2025, 7:54pm UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/5 "2025-04-27T19:54:53Z")

</div>

You can traverse the scene graph, only scene to parent axis doesn’t have a link. But finding all lines that are red wouldn’t be a problem

---

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [April 28, 2025, 2:24pm UTC](https://discourse.julialang.org/t/makie-parent-children-relationships/128457/6 "2025-04-28T14:24:28Z")

</div>

While at it, I have just started learning about Scenes.  
I understand that these are the fundamental building blocks,  
but I find less learning material than for Figures/Axes/Plots etc.

May I have two more questions:

- Are Scenes mostly for developers and power users,  
but the general user can survive without using them?

- Parent/children relationships are already there for Scenes.  
Could Figures/Axes/Plots just borrow them?
