Документация Engee

Axis3

Страница в процессе перевода.

Взаимодействия с Axis3

Как и Axis, Axis3 поддерживает несколько предопределенных механизмов взаимодействия.

Поворот

Вы можете повернуть представление, щелкнув левой кнопкой мыши и перетащив его. Это взаимодействие зарегистрировано как :dragrotate и использует тип DragRotate.

Масштабирование

Вы можете изменять масштаб оси, используя прокрутку для его увеличения и уменьшения. По умолчанию режим масштабирования сфокусирован на центре оси. Чтобы сфокусировать режим масштабирования на курсоре, задайте zoommode = :cursor. Если во время прокрутки нажать x, y или z, изменение масштаба будет ограничено этим измерением. При одновременном нажатии двух клавиш масштабирование будет ограничено соответствующей плоскостью. Эти клавиши можно изменить с помощью атрибутов xzoomkey, yzoomkey и zzoomkey. Вы всегда можете ограничивать измерения масштаба, задавая атрибутам оси xzoomlock, yzoomlock или zzoomlock значение true.

При viewmode = :free поведение режима масштабирования меняется. Вместо того чтобы влиять только на содержимое оси, масштабирование затрагивает ось в целом. Оно также отключает zoommode = :cursor. Это взаимодействие зарегистрировано как :scrollzoom и использует тип ScrollZoom.

Перемещение

Чтобы переместить представление Axis3, щелкните правой кнопкой мыши и перетащите его. Если во время перемещения нажать x, y или z, оно будет ограничено этим измерением. При одновременном нажатии двух клавиш перемещение будет ограничено соответствующей плоскостью. Эти клавиши можно изменить с помощью атрибутов xtranslationkey, ytranslationkey и ztranslationkey. Вы всегда можете ограничивать перемещение, задавая атрибутам оси xtranslationlock, ytranslationlock или ztranslationlock значение true.

При viewmode = :free добавляется еще один вариант перемещения. Если нажать control при перетаскивании с щелчком правой кнопки мыши, перемещение повлияет на размещение оси в окне, а не на содержимое внутри оси. Это взаимодействие зарегистрировано как :translation и использует тип DragPan.

Сброс ограничений

Для сброса ограничений, например для масштабирования и перемещения, используйте ctrl + left click. Это равносильно вызову reset_limits!(ax). В этом случае ограничения сбрасываются до значений, сохраненных в ax.limits. Если ограничения равны nothing, они вычисляются автоматически. Если вы ранее вызывали limits!, xlims!, ylims! или zlims!, в этом взаимодействии будет задан и сохранен ax.limits. Сбросить режим поворота оси можно с помощью shift + left click. Если viewmode = :free, перемещение оси (а не только его содержимого), также будет сброшено. При одновременном использовании обоих вариантов, т. е. нажатии сочетания ctrl + shift + leftclick, параметры оси будут сброшены полностью. Сюда входят ax.limits, которые сбрасываются до значения nothing с помощью autolimits!(ax). Это взаимодействие зарегистрировано как :limitreset и использует тип LimitReset.

Центрирование на точке

С помощью alt + left click можно отцентрировать ось на курсоре. Учтите, что в зависимости от типа графика можно получить разные результаты. В большинстве случаев используется точка на поверхности графика. Для meshscatter, scatter и производных графиков используется положение рассеянной сетки или маркера. Это взаимодействие зарегистрировано как :cursorfocus и использует тип FocusOnCursor.

Атрибуты

MarkdownAST.Heading(3)

Defaults to Inside()

The alignment of the scene in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to (1.0, 1.0, 2 / 3)

Controls the lengths of the three axes relative to each other.

Options are:

  • A three-tuple of numbers, which sets the relative lengths of the x, y and z axes directly

  • :data which sets the length ratios equal to the limit ratios of the axes. This results in an "unsquished" look where a cube in data space looks like a cube and not a cuboid.

  • :equal which is a shorthand for (1, 1, 1)

fig = Figure()

Axis3(fig[1, 1], aspect = (1, 1, 1), title = "aspect = (1, 1, 1)")
Axis3(fig[1, 2], aspect = (2, 1, 1), title = "aspect = (2, 1, 1)")
Axis3(fig[2, 1], aspect = (1, 2, 1), title = "aspect = (1, 2, 1)")
Axis3(fig[2, 2], aspect = (1, 1, 2), title = "aspect = (1, 1, 2)")

fig
using FileIO

fig = Figure()

brain = load(assetpath("brain.stl"))

ax1 = Axis3(fig[1, 1], aspect = :equal, title = "aspect = :equal")
ax2 = Axis3(fig[1, 2], aspect = :data, title = "aspect = :data")

for ax in [ax1, ax2]
    mesh!(ax, brain, color = :gray80)
end

fig

MarkdownAST.Heading(3)

Defaults to Keyboard.left_control | Keyboard.right_control

Sets the key that must be pressed to translate the whole axis (as opposed to the content) with viewmode = :free.

MarkdownAST.Heading(3)

Defaults to 1.275pi

The azimuth (left / right) angle of the camera.

At azimuth = 0, the camera looks at the axis from a point on the positive x axis, and rotates to the right from there with increasing values. At the default value 1.275π, the x axis goes to the right and the y axis to the left.

fig = Figure()

for (i, azimuth) in enumerate([0, 0.1, 0.2, 0.3, 0.4, 0.5])
    Axis3(fig[fldmod1(i, 3)...], azimuth = azimuth * pi,
        title = "azimuth = $(azimuth)π", viewmode = :fit)
end

fig

MarkdownAST.Heading(3)

Defaults to :transparent

The background color

MarkdownAST.Heading(3)

Defaults to true

Controls whether content is clipped at the axis frame. Note that you can also overwrite clipping per plot by setting clip_planes = Plane3f[].

MarkdownAST.Heading(3)

Defaults to false

Controls whether decorations are cut off outside the layout area assigned to the axis.

MarkdownAST.Heading(3)

Defaults to Keyboard.left_alt & Mouse.left

Sets the key/button for centering the Axis3 on the currently hovered position.

MarkdownAST.Heading(3)

Defaults to nothing

Global state for the x dimension conversion.

MarkdownAST.Heading(3)

Defaults to nothing

Global state for the y dimension conversion.

MarkdownAST.Heading(3)

Defaults to nothing

Global state for the z dimension conversion.

MarkdownAST.Heading(3)

Defaults to pi / 8

The elevation (up / down) angle of the camera. Possible values are between -pi/2 (looking from the bottom up) and +pi/2 (looking from the top down).

fig = Figure()

for (i, elevation) in enumerate([0, 0.05, 0.1, 0.15, 0.2, 0.25])
    Axis3(fig[fldmod1(i, 3)...], elevation = elevation * pi,
        title = "elevation = $(elevation)π", viewmode = :fit)
end

fig

MarkdownAST.Heading(3)

Defaults to false

Controls if the 4. Spines are created to close the outline box

MarkdownAST.Heading(3)

Defaults to :center

The horizontal alignment of the scene in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to nothing

The height setting of the scene.

MarkdownAST.Heading(3)

Defaults to (nothing, nothing, nothing)

The limits that the user has manually set. They are reinstated when calling reset_limits! and are set to nothing by autolimits!. Can be either a tuple (xlow, xhigh, ylow, yhigh, zlow, zhigh) or a tuple (nothing_or_xlims, nothing_or_ylims, nothing_or_zlims). Are set by xlims!, ylims!, zlims! and limits!.

MarkdownAST.Heading(3)

Defaults to 0.001

Sets the minimum value for near. Increasing this value will make objects close to the camera clip earlier. Reducing this value too much results in depth values becoming inaccurate. Must be > 0.

MarkdownAST.Heading(3)

Defaults to 0.0

This setting offers a simple scale from 0 to 1, where 0 looks like an orthographic projection (no perspective) and 1 is a strong perspective look. For most data visualization applications, perspective should be avoided because it makes interpreting the data correctly harder. It can be of use, however, if aesthetics are more important than neutral presentation.

fig = Figure()

for (i, perspectiveness) in enumerate(range(0, 1, length = 6))
    ax = Axis3(fig[fldmod1(i, 3)...]; perspectiveness, protrusions = (0, 0, 0, 15),
        title = ":perspectiveness = $(perspectiveness)")
    hidedecorations!(ax)
end

fig

MarkdownAST.Heading(3)

Defaults to 30

The protrusions control how much gap space is reserved for labels etc. on the sides of the Axis3. Unlike Axis, Axis3 currently does not set these values automatically depending on the properties of ticks and labels. This is because the effective protrusions also depend on the rotation and scaling of the axis cuboid, which changes whenever the Axis3 shifts in the layout. Therefore, auto-updating protrusions could lead to an endless layout update cycle.

The default value of 30 for all sides is just a heuristic and might lead to collisions of axis decorations with the Figure boundary or other plot elements. If that’s the case, you can try increasing the value(s).

The protrusions attribute accepts a single number for all sides, or a tuple of (left, right, bottom, top).

    fig = Figure(backgroundcolor = :gray97)
    Box(fig[1, 1], strokewidth = 0) # visualizes the layout cell
    Axis3(fig[1, 1], protrusions = 100, viewmode = :stretch,
        title = "protrusions = 100")
    fig
    fig = Figure(backgroundcolor = :gray97)
    Box(fig[1, 1], strokewidth = 0) # visualizes the layout cell
    ax = Axis3(fig[1, 1], protrusions = (0, 0, 0, 20), viewmode = :stretch,
        title = "protrusions = (0, 0, 0, 20)")
    hidedecorations!(ax)
    fig

MarkdownAST.Heading(3)

Defaults to Rect3d(Vec3d(0), Vec3d(1))

The limits that the axis tries to set given other constraints like aspect. Don’t set this directly, use xlims!, ylims! or limits! instead.

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s height

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s width

MarkdownAST.Heading(3)

Defaults to ""

The axis title string.

MarkdownAST.Heading(3)

Defaults to :center

The horizontal alignment of the title.

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The color of the title

MarkdownAST.Heading(3)

Defaults to :bold

The font family of the title.

MarkdownAST.Heading(3)

Defaults to 4.0

The gap between axis and title.

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The title’s font size.

MarkdownAST.Heading(3)

Defaults to true

Controls if the title is visible.

MarkdownAST.Heading(3)

Defaults to :center

The vertical alignment of the scene in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to :fitzoom

The view mode affects the final projection of the axis by fitting the axis cuboid into the available space in different ways.

  • :fit uses a fixed scaling such that a tight sphere around the cuboid touches the frame edge. This means that the scaling doesn’t change when rotating the axis (the apparent size of the axis stays the same), but not all available space is used. The chosen aspect is maintained using this setting.

  • :fitzoom uses a variable scaling such that the closest cuboid corner touches the frame edge. When rotating the axis, the apparent size of the axis changes which can result in a "pumping" visual effect. The chosen aspect is also maintained using this setting.

  • :stretch pulls the cuboid corners to the frame edges such that the available space is filled completely. The chosen aspect is not maintained using this setting, so :stretch should not be used if a particular aspect is needed.

  • :free behaves like :fit but changes some interactions. Zooming affects the whole axis rather than just the content. This allows you to zoom in on content without it getting clipped by the 3D bounding box of the Axis3. zoommode = :cursor is disabled. Translations can no also affect the axis as a whole with control + right drag.

fig = Figure()

for (i, viewmode) in enumerate([:fit, :fitzoom, :stretch])
    for (j, elevation) in enumerate([0.1, 0.2, 0.3] .* pi)

        Label(fig[i, 1:3, Top()], "viewmode = $(repr(viewmode))", font = :bold)

        # show the extent of each cell using a box
        Box(fig[i, j], strokewidth = 0, color = :gray95)

        ax = Axis3(fig[i, j]; viewmode, elevation, protrusions = 0, aspect = :equal)
        hidedecorations!(ax)

    end
end

fig

MarkdownAST.Heading(3)

Defaults to nothing

The width setting of the scene.

MarkdownAST.Heading(3)

Defaults to (0.05, 0.05)

The relative margins added to the autolimits in x direction.

MarkdownAST.Heading(3)

Defaults to RGBAf(0, 0, 0, 0.12)

The x grid color

MarkdownAST.Heading(3)

Defaults to true

Controls if the x grid is visible

MarkdownAST.Heading(3)

Defaults to 1

The x grid width

MarkdownAST.Heading(3)

Defaults to "x"

The x label

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The x label align

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The x label color

MarkdownAST.Heading(3)

Defaults to :regular

The x label font

MarkdownAST.Heading(3)

Defaults to 40

The x label offset

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The x label rotation in radians

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The x label size

MarkdownAST.Heading(3)

Defaults to true

Controls if the x label is visible

MarkdownAST.Heading(3)

Defaults to false

Controls if the x axis goes rightwards (false) or leftwards (true) in default camera orientation.

using FileIO

fig = Figure()

brain = load(assetpath("brain.stl"))

ax1 = Axis3(fig[1, 1], title = "xreversed = false")
ax2 = Axis3(fig[2, 1], title = "xreversed = true", xreversed = true)
for ax in [ax1, ax2]
    mesh!(ax, brain, color = getindex.(brain.position, 1))
end

fig

MarkdownAST.Heading(3)

Defaults to :black

The color of x spine 1 where the ticks are displayed

MarkdownAST.Heading(3)

Defaults to :black

The color of x spine 2 towards the center

MarkdownAST.Heading(3)

Defaults to :black

The color of x spine 3 opposite of the ticks

MarkdownAST.Heading(3)

Defaults to :black

The color of x spine 4

MarkdownAST.Heading(3)

Defaults to true

Controls if the x spine is visible

MarkdownAST.Heading(3)

Defaults to 1

The x spine width

MarkdownAST.Heading(3)

Defaults to :black

The x tick color

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The x tick format

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The x ticklabel color

MarkdownAST.Heading(3)

Defaults to :regular

The x ticklabel font

MarkdownAST.Heading(3)

Defaults to 5

The x ticklabel pad

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The x ticklabel size

MarkdownAST.Heading(3)

Defaults to true

Controls if the x ticklabels are visible

MarkdownAST.Heading(3)

Defaults to WilkinsonTicks(5; k_min = 3)

The x ticks

MarkdownAST.Heading(3)

Defaults to 6

The size of the xtick marks.

MarkdownAST.Heading(3)

Defaults to true

Controls if the x ticks are visible

MarkdownAST.Heading(3)

Defaults to 1

The x tick width

MarkdownAST.Heading(3)

Defaults to Keyboard.x

The key for limiting translation to the x direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive translation in the x direction.

MarkdownAST.Heading(3)

Defaults to :transparent

The color of the xy panel

MarkdownAST.Heading(3)

Defaults to true

Controls if the xy panel is visible

MarkdownAST.Heading(3)

Defaults to Keyboard.x

The key for limiting zooming to the x direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive zooming in the x direction.

MarkdownAST.Heading(3)

Defaults to :transparent

The color of the xz panel

MarkdownAST.Heading(3)

Defaults to true

Controls if the xz panel is visible

MarkdownAST.Heading(3)

Defaults to (0.05, 0.05)

The relative margins added to the autolimits in y direction.

MarkdownAST.Heading(3)

Defaults to RGBAf(0, 0, 0, 0.12)

The y grid color

MarkdownAST.Heading(3)

Defaults to true

Controls if the y grid is visible

MarkdownAST.Heading(3)

Defaults to 1

The y grid width

MarkdownAST.Heading(3)

Defaults to "y"

The y label

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The y label align

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The y label color

MarkdownAST.Heading(3)

Defaults to :regular

The y label font

MarkdownAST.Heading(3)

Defaults to 40

The y label offset

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The y label rotation in radians

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The y label size

MarkdownAST.Heading(3)

Defaults to true

Controls if the y label is visible

MarkdownAST.Heading(3)

Defaults to false

Controls if the y axis goes leftwards (false) or rightwards (true) in default camera orientation.

using FileIO

fig = Figure()

brain = load(assetpath("brain.stl"))

ax1 = Axis3(fig[1, 1], title = "yreversed = false")
ax2 = Axis3(fig[2, 1], title = "yreversed = true", yreversed = true)
for ax in [ax1, ax2]
    mesh!(ax, brain, color = getindex.(brain.position, 2))
end

fig

MarkdownAST.Heading(3)

Defaults to :black

The color of y spine 1 where the ticks are displayed

MarkdownAST.Heading(3)

Defaults to :black

The color of y spine 2 towards the center

MarkdownAST.Heading(3)

Defaults to :black

The color of y spine 3 opposite of the ticks

MarkdownAST.Heading(3)

Defaults to :black

The color of y spine 4

MarkdownAST.Heading(3)

Defaults to true

Controls if the y spine is visible

MarkdownAST.Heading(3)

Defaults to 1

The y spine width

MarkdownAST.Heading(3)

Defaults to :black

The y tick color

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The y tick format

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The y ticklabel color

MarkdownAST.Heading(3)

Defaults to :regular

The y ticklabel font

MarkdownAST.Heading(3)

Defaults to 5

The y ticklabel pad

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The y ticklabel size

MarkdownAST.Heading(3)

Defaults to true

Controls if the y ticklabels are visible

MarkdownAST.Heading(3)

Defaults to WilkinsonTicks(5; k_min = 3)

The y ticks

MarkdownAST.Heading(3)

Defaults to 6

The size of the ytick marks.

MarkdownAST.Heading(3)

Defaults to true

Controls if the y ticks are visible

MarkdownAST.Heading(3)

Defaults to 1

The y tick width

MarkdownAST.Heading(3)

Defaults to Keyboard.y

The key for limiting translations to the y direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive translation in the y direction.

MarkdownAST.Heading(3)

Defaults to Keyboard.y

The key for limiting zooming to the y direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive zooming in the y direction.

MarkdownAST.Heading(3)

Defaults to :transparent

The color of the yz panel

MarkdownAST.Heading(3)

Defaults to true

Controls if the yz panel is visible

MarkdownAST.Heading(3)

Defaults to (0.05, 0.05)

The relative margins added to the autolimits in z direction.

MarkdownAST.Heading(3)

Defaults to RGBAf(0, 0, 0, 0.12)

The z grid color

MarkdownAST.Heading(3)

Defaults to true

Controls if the z grid is visible

MarkdownAST.Heading(3)

Defaults to 1

The z grid width

MarkdownAST.Heading(3)

Defaults to "z"

The z label

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The z label align

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The z label color

MarkdownAST.Heading(3)

Defaults to :regular

The z label font

MarkdownAST.Heading(3)

Defaults to 50

The z label offset

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The z label rotation in radians

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The z label size

MarkdownAST.Heading(3)

Defaults to true

Controls if the z label is visible

MarkdownAST.Heading(3)

Defaults to :center

Controls what reference point is used when zooming. Can be :center for centered zooming or :cursor for zooming centered approximately where the cursor is. This is disabled with viewmode = :free.

MarkdownAST.Heading(3)

Defaults to false

Controls if the z axis goes upwards (false) or downwards (true) in default camera orientation.

using FileIO

fig = Figure()

brain = load(assetpath("brain.stl"))

ax1 = Axis3(fig[1, 1], title = "zreversed = false")
ax2 = Axis3(fig[2, 1], title = "zreversed = true", zreversed = true)
for ax in [ax1, ax2]
    mesh!(ax, brain, color = getindex.(brain.position, 3))
end

fig

MarkdownAST.Heading(3)

Defaults to :black

The color of z spine 1 where the ticks are displayed

MarkdownAST.Heading(3)

Defaults to :black

The color of z spine 2 towards the center

MarkdownAST.Heading(3)

Defaults to :black

The color of z spine 3 opposite of the ticks

MarkdownAST.Heading(3)

Defaults to :black

The color of z spine 4

MarkdownAST.Heading(3)

Defaults to true

Controls if the z spine is visible

MarkdownAST.Heading(3)

Defaults to 1

The z spine width

MarkdownAST.Heading(3)

Defaults to :black

The z tick color

MarkdownAST.Heading(3)

Defaults to Makie.automatic

The z tick format

MarkdownAST.Heading(3)

Defaults to @inherit :textcolor :black

The z ticklabel color

MarkdownAST.Heading(3)

Defaults to :regular

The z ticklabel font

MarkdownAST.Heading(3)

Defaults to 10

The z ticklabel pad

MarkdownAST.Heading(3)

Defaults to @inherit :fontsize 16.0f0

The z ticklabel size

MarkdownAST.Heading(3)

Defaults to true

Controls if the z ticklabels are visible

MarkdownAST.Heading(3)

Defaults to WilkinsonTicks(5; k_min = 3)

The z ticks

MarkdownAST.Heading(3)

Defaults to 6

The size of the ztick marks.

MarkdownAST.Heading(3)

Defaults to true

Controls if the z ticks are visible

MarkdownAST.Heading(3)

Defaults to 1

The z tick width

MarkdownAST.Heading(3)

Defaults to Keyboard.z

The key for limiting translations to the y direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive translation in the z direction.

MarkdownAST.Heading(3)

Defaults to Keyboard.z

The key for limiting zooming to the z direction.

MarkdownAST.Heading(3)

Defaults to false

Locks interactive zooming in the z direction.