# Context menu in Makie?

**URL:** <https://discourse.julialang.org/t/context-menu-in-makie/66728>\
**Category:** Specific Domains\
**Tags:** makie\
**Created:** [August 20, 2021, 12:56pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728 "2021-08-20T12:56:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 20, 2021, 12:56pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/1 "2021-08-20T12:56:30Z")

</div>

Does Makie support context menus, e.g. reachable by right clicking into a view that is covered by a particular axis? This would be a great feature.

---

<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:** [August 20, 2021, 2:27pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/2 "2021-08-20T14:27:58Z")

</div>

It’s possible to implement, you’d need to create a scene on right click. It’s similar to how the Menu works. You could probably translate that scene forward and the normal things like Buttons etc should work, although I’ve never tried.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 20, 2021, 4:42pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/3 "2021-08-20T16:42:53Z")

</div>

Thanks. I am a bit puzzled by what a `scene` is. The documentation does not speak much of `scene` anymore, but all the help files do. So I am usually guessing the arguments to use instead of a scene. Anyway, an existing easy to use context menu would be a great addition.

---

<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:** [August 20, 2021, 6:40pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/4 "2021-08-20T18:40:39Z")

</div>

Honestly even I don’t understand all the implications of what a scene is. You can treat it like a rectangular area that has some camera projection associated to it. All the old Makie stuff had only `Scene` to work with, since I added Axis, Axis3, Figure, and all the layout things, that part of the API has moved much more into the background.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 21, 2021, 6:52am UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/5 "2021-08-21T06:52:01Z")

</div>

🙂 But how do I get access to a scene?  
I typically create first the place where something should go via:

```julia
ax_im_zy = Axis(fig[1,1], yreversed = true, alignmode = Inside())

```

and then fill it with data via

```julia
image!(my_image_data, interpolate=false)

```

How can I then access the scene corresponding to the image?  
Or how can I “create a scene”. The [documentation](https://makie.juliaplots.org/stable/scenes.html#Scenes) speaks of what a scene is and how to modify or update it, but not how it is created (presumably by calling `Scene()`?) and how you get access to it.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [August 21, 2021, 11:54am UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/6 "2021-08-21T11:54:51Z")

</div>

Should be `ax_im_zy.scene`… A plot doesn’t get its own scene, so this is the scene of the axis, and whatever gets plotted into it.  
I’m currently working on cleaning up & documenting the scene 😉  
[https://github.com/JuliaPlots/Makie.jl/pull/1192](https://github.com/JuliaPlots/Makie.jl/pull/1192)

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 30, 2021, 7:09pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/7 "2021-08-30T19:09:20Z")

</div>

Btw. How do you navigate through nested grid layouts? `fig[1,2].layout[2,2]` etc. does not seem to work but yields some sort of infinite regress. Also: Can you retrieve an `Axis` from the layout or do you need to keep track of various axes separately?

---

<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:** [August 30, 2021, 9:20pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/8 "2021-08-30T21:20:01Z")

</div>

You can use the `content` and `contents` functions to retrieve objects from layouts at certain positions. `layout[row, col]` is defined to return a `GridPosition`, so you can’t retrieve objects that way. This wouldn’t work well anyway, as objects are not stored in slots like in a matrix.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 31, 2021, 4:55am UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/9 "2021-08-31T04:55:02Z")

</div>

Thanks for this hint. But how do you address a grid cell in a nested layout to get the content from?

---

<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:** [August 31, 2021, 10:27am UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/10 "2021-08-31T10:27:35Z")

</div>

This is the relevant section [Figures](http://makie.juliaplots.org/v0.15.2/documentation/figure/index.html#retrieving_objects_from_a_figure)

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [August 31, 2021, 2:44pm UTC](https://discourse.julialang.org/t/context-menu-in-makie/66728/11 "2021-08-31T14:44:59Z")

</div>

Thanks!
