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

AbstractPlotting.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
AbstractPlotting.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
AbstractPlotting.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
AbstractPlotting.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
AbstractPlotting.xticks!Function
xticks!([scene,]; xtickrange=xtickrange(scene), xticklabels=xticklabel(scene))

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

source
AbstractPlotting.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
AbstractPlotting.zticks!Function
zticks!([scene,]; ztickranges=ztickrange(scene), zticklabels=zticklabel(scene))

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

source

## Axis2D

### Axis2D attributes groups

SymbolDescription
frameSee the detailed descriptions for frame attributes.
gridSee the detailed descriptions for grid attributes.
namesSee the detailed descriptions for names attributes.
ticksSee the detailed descriptions for ticks attributes.

#### :grid

SymbolDescription
linecolorSymbol or Colorant. Specifies the color of the grid lines. Can be a color symbol/string like :red, or a Colorant.
linestyle
linewidthNTuple{2, Number}. Width of the x and y grids.

#### :ticks

SymbolDescription
alignNTuple{2,(:pos, :pos)}. Specify the text alignment for the axis ticks, where :pos can be :left, :center, or :right
fontNTuple{2,String}. Specifies the font and can name any font available on the system.
gapNumber. Specifies the gap (in pixels) between the axis tick labels and the axes themselves.
linecolorNTuple{2,Symbol or Colorant}. Specifies the color of the grid lines. Can be a color symbol/string like :red, or a Colorant.
linestyle
linewidthNTuple{2,Number}. Width of the axes ticks.
rotationNTuple{3,Float32}. Specifies the rotations for each axis's ticks, in radians.
textcolorNTuple{2,Symbol or Colorant}. Specifies the color of the axes ticks. Can be a color symbol/string like :red, or a Colorant.
textsizeNTuple{2,Int}. Font pointsize for tick labels.
title_gapNumber. Specifies the gap (in pixels) between the axis titles and the axis tick labels.

#### :frame

SymbolDescription
arrow_sizeNumber. Size of the axes arrows.
axis_arrowBool. Toggles the axes arrows.
axis_position
framesNTuple{2,NTuple{2,Bool}}.
linecolorSymbol or Colorant. Specifies the color of the grid lines. Can be a color symbol/string like :red, or a Colorant.
linestyle
linewidthNumber. Widths of the axes frame lines.

#### :names

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

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