Context menu in Makie?

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.

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.

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.

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.

1 Like

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

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

and then fill it with data via

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 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.

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 :wink:
https://github.com/JuliaPlots/Makie.jl/pull/1192

2 Likes

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?

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.

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

This is the relevant section Figures

Thanks!