Scenes
|
The page is in the process of being translated. |
What is a Scene?
Scenes are fundamental building blocks of Makie figures. A Scene is like a container for Plots and other Scenes. Scenes have Plots and Subscenes associated with them. Every Scene also has a transformation, made up of scale, translation, and rotation.
|
Note Before the introduction of the |
A Scene’s plots can be accessed via scene.plots.
A Scene’s subscenes (also called children) can be accessed through scene.children. This will return an Array of the Scene's child scenes. A child scene can be created by childscene = Scene(parentscene).
Any Scene with an axis also has a camera associated with it; this can be accessed through camera(scene), and its controls through cameracontrols(scene). More documentation about these is in the Cameras section.
Scenes have a configurable size. You can set the size in device-independent pixels by doing Scene(size = (500, 500)). (More about sizes, resolutions and units in Figure size and resolution or How to match figure size, font sizes and dpi)
Any keyword argument given to the Scene will be propagated to its plots; therefore, you can set the palette or the colormap in the Scene itself.
Subscenes
A subscene is no different than a normal Scene, except that it is linked to a "parent" Scene. It inherits the transformations of the parent Scene, but can then be transformed independently of it.
Scene Attributes
-
scene.clear = true: Scenes are drawn parent first onto the same image. Ifclear = truefor a (sub)scene it will clear the previously drawn things in its region to itsbackgroundcolor. Otherwise the plots inscenewill be drawn on top and the backgroundcolor will be ignored. Note that this is not technically an attribute but just a field ofScene. -
ssao = SSAO(bias = 0.025, blur=2, radius=0.5): Controls SSAO settings, see lighting documentation. -
size = (800, 600): Sets the size of the created window if the scene is the root scene.
Modifying A Scene
Makie offers mutation functions to scale, translate and rotate your Scenes on the fly.
#
Makie.translate! — Function
translate!(t::Transformable, xyz::VecTypes)
translate!(t::Transformable, xyz...)
Apply an absolute translation to the given Transformable (a Scene or Plot), translating it to x, y, z.
#
Makie.rotate! — Function
rotate!(Accum, t::Transformable, axis_rot...)
Apply a relative rotation to the transformable, by multiplying by the current rotation.
#
Makie.scale! — Function
scale!([mode = Absolute], t::Transformable, xyz...)
scale!([mode = Absolute], t::Transformable, xyz::VecTypes)
Scale the given t::Transformable (a Scene or Plot) to the given arguments xyz. Any missing dimension will be scaled by 1. If mode == Accum the given scaling will be multiplied with the previous one.
Updating the Scene
When the Scene is changed, you may need to update several aspects of it. Makie provides three main updating functions:
#
Makie.update_cam! — Function
update_cam!(scene::SceneLike, area)
Updates the camera for the given scene to cover the given area in 2d.
Events
Scenes have several pre-created event "hooks" (through Observables) that you can handle. These can be accessed through scene.events, which returns an Events struct.