空间
|
该页面正在翻译中。 |
每个图的数据在显示之前都要经过许多转换。 在Makie中,我们将它们分为三组-标准化类型的转换,情节拥有 转换转换数据和场景拥有的投影,在坐标系之间移动。 (你可能会想到像 轴心,轴心 就像这里的场景一样。 它们各自包装一个场景,或多或少直接管理它及其投影。)你可在 转换,转换和投影管道。
该 空间 属性声明绘图相对于投影的坐标系。 因此,您可以在不创建新场景的情况下更改应用于情节的投影。 您对此的选择仅限于:
-
空间=:数据:情节在由场景摄像机定义的空间中,并使用它的视图和投影矩阵。 -
空间=:像素:该图以像素为单位,并根据场景视口进行投影。 -
空间=:相对:情节是一个0。.1归一化空间。 -
空间=:剪辑:情节在a-1。.1归一化空间。
using CairoMakie
using GLMakie
f = Figure()
a = Axis(f[1, 1], limits = (-10, 10, -10, 10),
xminorgridvisible = true, xminorticksvisible = true, xminorticks = IntervalsBetween(5),
yminorgridvisible = true, yminorticksvisible = true, yminorticks = IntervalsBetween(5))
text_kwargs = (align = (:left, :center), offset = (10, 0))
# default
scatter!(a, Point2f(4, 5), space = :data)
text!(a, Point2f(4, 5), text = "(4, 5) in world space", space = :data; text_kwargs...)
scatter!(a, Point2f(50, 50), space = :pixel)
text!(a, Point2f(50, 50), text = "(50, 50) in pixel space", space = :pixel; text_kwargs...)
scatter!(a, Point2f(0.3, 0.8), space = :relative)
text!(a, Point2f(0.3, 0.8), text = "(0.3, 0.8) in relative space", space = :relative; text_kwargs...)
scatter!(a, Point2f(0, 0.1), space = :clip)
text!(a, Point2f(0, 0.1), text = "(0, 0.1) in clip space", space = :clip; text_kwargs...)
f
标记空间
一些图也允许你设置一个 标记空间. 在这些情况下,投影分为两个步骤。 第一个项目从 空间 到 标记空间. 在那里,投影参数与其他数据合并。 例如,在scatter中,每个投影位置都会扩展为四边形,其大小,位置和方向基于 标记大小, marker_offset 和 轮调 属性。 结果然后继续得到投影作为需要被显示。 什么 标记空间 do,is允许您选择哪些坐标系属性,如 标记大小 等适用。 这里的选项与 空间.
</无翻译>
using CairoMakie
using GLMakie
f = Figure()
a = Axis(f[1, 1], limits = (-10, 10, -10, 10),
xminorgridvisible = true, xminorticksvisible = true, xminorticks = IntervalsBetween(5),
yminorgridvisible = true, yminorticksvisible = true, yminorticks = IntervalsBetween(5))
text_kwargs = (align = (:left, :center), offset = (10, 0))
# markerspace is :pixel by default for scatter
# marker = Circle fills out the full markersize^2 quad
scatter!(a, Point2f(-7, 7), markerspace = :pixel, markersize = 20, marker = Circle)
text!(a, Point2f(-7, 7), text = "pixel space w/ markersize = 20"; text_kwargs...)
scatter!(a, Point2f(-7, 2), markerspace = :clip, markersize = 0.2, marker = Circle)
text!(a, Point2f(-7, 2), text = "clip space w/ markersize = 0.2"; text_kwargs...)
scatter!(a, Point2f(-7, -2), markerspace = :relative, markersize = 0.2, marker = Circle)
text!(a, Point2f(-7, -2), text = "relative space w/ markersize = 0.2"; text_kwargs...)
scatter!(a, Point2f(-7, -7), markerspace = :data, markersize = 2, marker = Circle)
text!(a, Point2f(-7, -7), text = "world space w/ markersize = 2"; text_kwargs...)
f