Scenes are fundamental building blocks of Makie figures. A Scene is like a container for
Plots and other
Subscenes associated with them. Every Scene also has a transformation, made up of scale, translation, and rotation.
Before the introduction of the
Scenes used to be the main container object which was returned from all plotting functions. Now, scenes are mostly an implementation detail for many users, unless they want to build custom solutions that go beyond what the default system offers.
A Scene's plots can be accessed via
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).
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.
Scene's also have configurable size/resolution. You can set the size in pixels by doing
Scene(resolution = (500, 500)).
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.
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.clear = true: Scenes are drawn parent first onto the same image. If
clear = truefor a (sub)scene it will clear the previously drawn things in its region to its
backgroundcolor. Otherwise the plots in
scenewill be drawn on top and the backgroundcolor will be ignored. Note that this is not technically an attribute but just a field of
ssao = SSAO(bias = 0.025, blur=2, radius=0.5): Controls SSAO settings, see lighting documentation.
resolution = (800, 600): Sets the size of the created window if the scene is the root scene.
Makie offers mutation functions to scale, translate and rotate your Scenes on the fly.
translate!(scene::Transformable, xyz::VecTypes) translate!(scene::Transformable, xyz...)
Apply an absolute translation to the Scene, translating it to
x, y, z.
translate!(Accum, scene::Transformable, xyz...)
Translate the scene relative to its current position.
rotate!(Accum, scene::Transformable, axis_rot...)
Apply a relative rotation to the Scene, by multiplying by the current rotation.
rotate!(t::Transformable, axis_rot::Quaternion) rotate!(t::Transformable, axis_rot::AbstractFloat) rotate!(t::Transformable, axis_rot...)
Apply an absolute rotation to the Scene. Rotations are all internally converted to
scale!(t::Transformable, x, y) scale!(t::Transformable, x, y, z) scale!(t::Transformable, xyz) scale!(t::Transformable, xyz...)
Scale the given
Transformable (a Scene or Plot) to the given arguments. Can take
x, y or
x, y, z. This is an absolute scaling, and there is no option to perform relative scaling.
When the Scene is changed, you may need to update several aspects of it. Makie provides three main updating functions:
Updates the camera for the given
scene to cover the given
area in 2d.
Updates the camera for the given
scene to cover the limits of the
Scene. Useful when using the
update_cam!(scene::Scene, eyeposition, lookat, up = Vec3f(0, 0, 1))
Updates the camera's controls to point to the specified location.
Scenes have several pre-created event "hooks" (through Observables) that you can handle. These can be accessed through
scene.events, which returns an