Integrated Axes (Axis2D / Axis3D)

Note

Axis2D refers to the old Makie workflow in which the Scene was the main object for users to interact with. Back then, the default 2D axis was created like a plot object and therefore had many usability issues that were resolved with the new layout system and the new Axis type. Currently, the 3D axis still uses the old workflow, although you usually embed a scene with a 3D axis in a layout using the LScene wrapper.

The Axis2D or Axis3D is just a scene object, making it easy to manipulate and share between plots. These objects also contain the mapping you want to apply to the data and can interactively be changed. They can be created from any boundingbox and inserted into any plot.

There are two types of plot-like axes: Axis2D and Axis3D.

Interacting with the integrated axis

One can quite easily interact with the attributes of the axis like with any other plot.

You can access the axis of a scene by doing

axis = scene[OldAxis]

The axis attributes are nested, and there are different attributes depending on whether it is an Axis2D or Axis3D object.

You can access the nested attributes in multiple ways. Take the nested attribute axis -> :names -> :axisnames, for example:

  1. axis[:names, :axisnames] = ("x", "y", "z")
  2. axis[:names][:axisnames] = ("x", "y", "z")
  3. axis = (names = (axisnames = ("x", "y", "z"),),)

Convenience functions for integrated axes

Makie offers some convenience functions to make manipulating the Axis2D / Axis3D easier.

Makie.xlims!Function
xlims!(limits::Real...)
xlims!(limits::NTuple{2, Real})
xlims!(scene, limits::Real...)
xlims!(scene, limits::NTuple{2, Real})

Set the x-limits for the given Scene (defaults to current Scene).

source
Makie.ylims!Function
ylims!(limits::Real...)
ylims!(limits::NTuple{2, Real})
ylims!(scene, limits::Real...)
ylims!(scene, limits::NTuple{2, Real})

Set the y-limits for the given Scene (defaults to current Scene).

source
Makie.zlims!Function
zlims!(limits::Real...)
zlims!(limits::NTuple{2, Real})
zlims!(scene, limits::Real...)
zlims!(scene, limits::NTuple{2, Real})

Set the z-limits for the given Scene (defaults to current Scene).

source
Makie.xlabel!Function
xlabel!([scene,] xlabel)

Set the x-axis label for the given Scene. Defaults to using the current Scene.

source
Makie.ylabel!Function
ylabel!([scene,] ylabel)

Set the y-axis label for the given Scene. Defaults to using the current Scene.

source
Makie.zlabel!Function
zlabel!([scene,] zlabel)

Set the z-axis label for the given Scene. Defaults to using the current Scene.

Warning

The Scene must have an Axis3D. If not, then this function will error.

source
Makie.xticklabelsFunction
xticklabels(scene)

Returns the all the x-axis tick labels. See also ticklabels.

source
Makie.yticklabelsFunction
yticklabels(scene)

Returns the all the y-axis tick labels. See also ticklabels.

source
Makie.zticklabelsFunction
zticklabels(scene)

Returns the all the z-axis tick labels. See also ticklabels.

source
Makie.xtickrangeFunction
xtickrange(scene)

Returns the tick range along the x-axis. See also tickranges.

source
Makie.ytickrangeFunction
ytickrange(scene)

Returns the tick range along the y-axis. See also tickranges.

source
Makie.ztickrangeFunction
ztickrange(scene)

Returns the tick range along the z-axis. See also tickranges.

source
Makie.xticks!Function
xticks!([scene,]; xtickrange=xtickrange(scene), xticklabels=xticklabel(scene))

Set the tick labels and range along the x-axes. See also ticks!.

source
Makie.yticks!Function
yticks!([scene,]; ytickrange=ytickrange(scene), yticklabels=yticklabel(scene))

Set the tick labels and range along all the y-axis. See also ticks!.

source
Makie.zticks!Function
zticks!([scene,]; ztickranges=ztickrange(scene), zticklabels=zticklabel(scene))

Set the tick labels and range along all z-axis. See also ticks!.

source
Makie.xtickrotationFunction
xtickrotation(scene)

Returns the rotation of tick labels along the x-axis. See also tickrotations

source
Makie.ytickrotationFunction
ytickrotation(scene)

Returns the rotation of tick labels along the y-axis. See also tickrotations

source
Makie.ztickrotationFunction
ztickrotation(scene)

Returns the rotation of tick labels along the z-axis. See also tickrotations

source
Makie.xtickrotation!Function
xtickrotation!([scene,] xangle)

Set the rotation of tick labels along the x-axis. See also tickrotations!.

source
Makie.ytickrotation!Function
ytickrotation!([scene,] yangle)

Set the rotation of tick labels along the y-axis. See also tickrotations!.

source
Makie.ztickrotation!Function
ztickrotation!([scene,] zangle)

Set the rotation of tick labels along the z-axis. See also tickrotations!.

source

Axis3D

Axis3D attributes groups

SymbolDescription
frameSee the detailed descriptions for frame attributes.
namesSee the detailed descriptions for names attributes.
scaleNTuple{3,Float}. Specifies the scaling for the axes.
showaxisNTuple{3,Bool}. Specifies whether to show the axes.
showgridNTuple{3,Bool}. Specifies whether to show the axis grids.
showticksNTuple{3,Bool}. Specifies whether to show the axis ticks.
ticksSee the detailed descriptions for ticks attributes.

:ticks

SymbolDescription
alignNTuple{3,(:pos, :pos)}. Specify the text alignment for the axis ticks, where :pos can be :left, :center, or :right.
fontNTuple{3,String}. Specifies the font for the axis ticks, and can choose any font available on the system.
gapNumber. Specifies the gap (in pixels) between the axis ticks and the axes themselves.
rotationNTuple{3,Quaternion{Float32}}. Specifies the rotations for each axis's ticks, in radians.
textcolorNTuple{3,Symbol or Colorant}. Specifies the color of the axes ticks. Can be a color symbol/string like :red, or a Colorant.
textsizeInteger. Font pointsize for text.

:frame

SymbolDescription
axiscolorSymbol or Colorant. Specifies the color of the axes. Can be a color symbol/string like :red, or a Colorant.
linecolorSymbol or Colorant. Specifies the color of the grid lines. Can be a color symbol/string like :red, or a Colorant.
linewidthNumber. Width of the axes grid lines.

:names

SymbolDescription
alignNTuple{3,(:pos, :pos)}. Specify the text alignment for the axis labels, where :pos can be :left, :center, or :right.
axisnamesNTuple{3,String}. Specifies the axis labels.
fontNTuple{3,String}. Specifies the font for the axis labels, and can choose any font available on the system.
gapNumber. Specifies the gap (in pixels) between the axis labels and the axes themselves.
rotationNTuple{3,Quaternion{Float32}}. Specifies the rotations for each axis's label, in radians.
textcolorNTuple{3,Symbol or Colorant}. Specifies the color of the axes labels. Can be a color symbol/string like :red, or a Colorant.
textsizeNTuple{3,Int}. Font pointsize for axes labels.