Engee 文档

[医]三角帆

该页面正在翻译中。

tricontourf(triangles::Triangulation, zs; kwargs...)
tricontourf(xs, ys, zs; kwargs...)

绘制高度信息的填充三角图 zs 在水平位置 x 和垂直位置 ys. A 三角测量 来自DelaunayTriangulation。也可以提供jl代替 xys 用于指定三角形,否则为 xys 被计算。

绘图类型

绘图类型别名 [医]三角帆 功能是 [医]三角帆.

例子:

</无翻译>

using CairoMakie
using Random
Random.seed!(1234)

x = randn(50)
y = randn(50)
z = -sqrt.(x .^ 2 .+ y .^ 2) .+ 0.1 .* randn.()

f, ax, tr = tricontourf(x, y, z)
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
76d1680

</无翻译>

using CairoMakie
using Random
Random.seed!(1234)

x = randn(200)
y = randn(200)
z = x .* y

f, ax, tr = tricontourf(x, y, z, colormap = :batlow)
scatter!(x, y, color = z, colormap = :batlow, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
fbfdff8

三角测量模式

手动三角测量可以作为整数的3xn矩阵传递,其中三个整数的每列指定点向量中一个三角形的角的索引。 </无翻译>

using CairoMakie
using Random
Random.seed!(123)

n = 20
angles = range(0, 2pi, length = n+1)[1:end-1]
x = [cos.(angles); 2 .* cos.(angles .+ pi/n)]
y = [sin.(angles); 2 .* sin.(angles .+ pi/n)]
z = (x .- 0.5).^2 + (y .- 0.5).^2 .+ 0.5.*randn.()

triangulation_inner = reduce(hcat, map(i -> [0, 1, n] .+ i, 1:n))
triangulation_outer = reduce(hcat, map(i -> [n-1, n, 0] .+ i, 1:n))
triangulation = hcat(triangulation_inner, triangulation_outer)

f, ax, _ = tricontourf(x, y, z, triangulation = triangulation,
    axis = (; aspect = 1, title = "Manual triangulation"))
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)

tricontourf(f[1, 2], x, y, z, triangulation = Makie.DelaunayTriangulation(),
    axis = (; aspect = 1, title = "Delaunay triangulation"))
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)

f
5844e38

默认情况下, [医]三角帆 执行无约束三角测量。 可以通过使用以下方法实现对三角测量的更大控制,例如允许强制边界https://github.com/DanielVandH/DelaunayTriangulation.jl[DelaunayTriangulation.jl]并将由此产生的三角测量作为 [医]三角帆. 例如,上述环空也可以如下绘制: </无翻译>

using CairoMakie
using DelaunayTriangulation
using Random

Random.seed!(123)

n=20
角度=范围(0,2pi,长度=n+1)[1:end-1]
x=[cos.(角度);2。*cos。(角度。+pi/n)]
y=[罪。(角度);2。*罪。(角度。+pi/n)]
z=(x.- 0.5).^2+(y.- 0.5).^2 .+ 0.5.*兰德。()

内=[n:-1:1;n]#顺时针内
outer=[(n+1):(2n);n+1]#逆时针outer
boundary_nodes=[[外部],[内部]]
点=[x';y']
tri=triangulate(points;boundary_nodes=boundary_nodes)
f,ax,_=tricontourf(tri,z;
    轴=(;方面=1,标题="约束三角测量\nvia DelaunayTriangulation。jl"))
散开!(x,y,color=z,strokewidth=1,strokecolor=:黑色)
f
1b8e925

边界节点可以支持更复杂的区域,可能有孔,而不是只提供点本身。 </无翻译>

using CairoMakie
using DelaunayTriangulation

## Start by defining the boundaries, and then convert to the appropriate interface
curve_1 = [
    [(0.0, 0.0), (5.0, 0.0), (10.0, 0.0), (15.0, 0.0), (20.0, 0.0), (25.0, 0.0)],
    [(25.0, 0.0), (25.0, 5.0), (25.0, 10.0), (25.0, 15.0), (25.0, 20.0), (25.0, 25.0)],
    [(25.0, 25.0), (20.0, 25.0), (15.0, 25.0), (10.0, 25.0), (5.0, 25.0), (0.0, 25.0)],
    [(0.0, 25.0), (0.0, 20.0), (0.0, 15.0), (0.0, 10.0), (0.0, 5.0), (0.0, 0.0)]
] # outer-most boundary: counter-clockwise
curve_2 = [
    [(4.0, 6.0), (4.0, 14.0), (4.0, 20.0), (18.0, 20.0), (20.0, 20.0)],
    [(20.0, 20.0), (20.0, 16.0), (20.0, 12.0), (20.0, 8.0), (20.0, 4.0)],
    [(20.0, 4.0), (16.0, 4.0), (12.0, 4.0), (8.0, 4.0), (4.0, 4.0), (4.0, 6.0)]
] # inner boundary: clockwise
curve_3 = [
    [(12.906, 10.912), (16.0, 12.0), (16.16, 14.46), (16.29, 17.06),
    (13.13, 16.86), (8.92, 16.4), (8.8, 10.9), (12.906, 10.912)]
] # this is inside curve_2, so it's counter-clockwise
curves = [curve_1, curve_2, curve_3]
points = [
    (3.0, 23.0), (9.0, 24.0), (9.2, 22.0), (14.8, 22.8), (16.0, 22.0),
    (23.0, 23.0), (22.6, 19.0), (23.8, 17.8), (22.0, 14.0), (22.0, 11.0),
    (24.0, 6.0), (23.0, 2.0), (19.0, 1.0), (16.0, 3.0), (10.0, 1.0), (11.0, 3.0),
    (6.0, 2.0), (6.2, 3.0), (2.0, 3.0), (2.6, 6.2), (2.0, 8.0), (2.0, 11.0),
    (5.0, 12.0), (2.0, 17.0), (3.0, 19.0), (6.0, 18.0), (6.5, 14.5),
    (13.0, 19.0), (13.0, 12.0), (16.0, 8.0), (9.8, 8.0), (7.5, 6.0),
    (12.0, 13.0), (19.0, 15.0)
]
boundary_nodes, points = convert_boundary_points_to_indices(curves; existing_points=points)
edges = Set(((1, 19), (19, 12), (46, 4), (45, 12)))

## Extract the x, y
tri = triangulate(points; boundary_nodes = boundary_nodes, segments = edges)
z = [(x - 1) * (y + 1) for (x, y) in DelaunayTriangulation.each_point(tri)] # note that each_point preserves the index order
f, ax, _ = tricontourf(tri, z, levels = 30; axis = (; aspect = 1))
f
bb22240

</无翻译>

using CairoMakie
using DelaunayTriangulation

using Random
Random.seed!(1234)

θ = [LinRange(0, 2π * (1 - 1/19), 20); 0]
xy = Vector{Vector{Vector{NTuple{2,Float64}}}}()
cx = [0.0, 3.0]
for i in 1:2
    push!(xy, [[(cx[i] + cos(θ), sin(θ)) for θ in θ]])
    push!(xy, [[(cx[i] + 0.5cos(θ), 0.5sin(θ)) for θ in reverse(θ)]])
end
boundary_nodes, points = convert_boundary_points_to_indices(xy)
tri = triangulate(points; boundary_nodes=boundary_nodes)
z = [(x - 3/2)^2 + y^2 for (x, y) in DelaunayTriangulation.each_point(tri)] # note that each_point preserves the index order

f, ax, tr = tricontourf(tri, z, colormap = :matter)
f
7d814da

相对模式

有时,将值范围的一部分放下是有益的,通常朝向外边界。 无需手动指定要包含的级别,您可以设置 模式 属性为 :亲戚 并指定从0到1的水平,相对于当前的最小值和最大值。 </无翻译>

using CairoMakie
using Random
Random.seed!(1234)

x = randn(50)
y = randn(50)
z = -sqrt.(x .^ 2 .+ y .^ 2) .+ 0.1 .* randn.()

f, ax, tr = tricontourf(x, y, z, mode = :relative, levels = 0.2:0.1:1)
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
4281377

属性

阿尔法

默认值为 1.0

Colormap或color属性的alpha值。

夹式飞机

默认值为 自动的

剪辑平面提供了一种在3D空间中进行剪辑的方法。 您可以设置最多8个向量 平面3f 飞机在这里,后面的情节将被裁剪(即变得不可见)。 默认情况下,剪辑平面继承自父绘图或场景。 您可以删除父 夹式飞机 通过传递 平面3f[].

颜色表

默认值为 @继承colormap

设置颜色表,从中采样波段颜色。

色阶;色阶

默认值为 身份认同

颜色变换功能

depth_换档

默认值为 0.0

在所有其他变换之后(即在剪辑空间中)调整绘图的深度值,其中 0<=深度<=1. 这仅适用于GLMakie和WGLMakie,可用于调整渲染顺序(如可调谐透绘)。

边缘

默认值为 什么都没有

没有可用的文档。

延伸,延伸

默认值为 什么都没有

这将设置一个可选的附加波段的颜色从最高值 水平最大值(zs). 如果是 :自动,颜色表的高端被挑选,其余的颜色相应地移动。 如果是任何颜色表示,则使用此颜色。 如果是 什么都没有,没有添加带。

延伸,延伸

默认值为 什么都没有

这将设置一个可选的附加波段的颜色从 最小(zs) 至最低值 水平. 如果是 :自动,颜色表的下端被挑选,其余的颜色被相应地移动。 如果是任何颜色表示,则使用此颜色。 如果是 什么都没有,没有添加带。

外汇管理局

默认值为 真的

调整绘图是否使用fxaa(抗锯齿,仅限GLMakie)渲染。

可检查的

默认值为 @继承inspectable

设置此图是否应由 数据探测仪. 默认值取决于父场景的主题。

检查员-检查员

默认值为 自动的

设置回调函数 (检查员,情节)->。.. 用于清理DataInspector中的自定义指标。

检查员-检查员

默认值为 自动的

设置回调函数 (检查员,情节,索引)->。.. 它取代了默认值 显示_数据 方法。

检查器_label

默认值为 自动的

设置回调函数 (绘图、索引、位置)->字符串 它替换了DataInspector生成的默认标签。

水平

默认值为 10

可以是一个 Int型 其导致由n+1等间隔电平分隔的n个带,或者它可以是 [医]文摘{<:Real} 它列出了从低到高的n个连续边缘,从而产生n-1个带。

模式

默认值为 :正常

设置水平向量的解释方式,如果它设置为 :亲戚,每个数字被解释为最小值和最大值之间的分数 zs. 例如, 水平=0.1:0.1:1.0 将排除较低的10%的数据。

模型

默认值为 自动的

为绘图设置模型矩阵。 这将复盖使用 翻译!, 旋转!规模!.

纳米色

默认值为 :透明

没有可用的文档。

透支

默认值为 错误

控制绘图是否将绘制在其他绘图上。 这具体意味着忽略GL后端中的深度检查

空间

默认值为 :数据

设置包含情节的盒子的变换空间。 见 麦琪空间() 供可能的输入。

ssao

默认值为 错误

调整是否使用ssao(屏幕空间环境光遮蔽)渲染绘图。 请注意,这仅在3D绘图中有意义,并且仅适用于 fxaa=真.

转型

默认值为 :自动

没有可用的文档。

透明度

默认值为 错误

调整情节处理透明度的方式。 在GLMakie 透明度=真 导致使用顺序独立的透明度。

三角测量

默认值为 DelaunayTriangulation()

点的模式 xys 是三角测量的。 传球 DelaunayTriangulation() 执行Delaunay三角测量。 你也可以通过一个预先存在的三角测量作为一个 [医]抽象矩阵{<:Int} 与大小(3,n),其中每列指定一个三角形的顶点索引,或作为 三角测量 来自DelaunayTriangulation。jl.

可见

默认值为 真的

控制是否渲染绘图。