Mesh
Examples
- Plotting the :math:
sin(R)/Rfunction using a mesh.
::
let x = linspace(-8.0, 8.0, num: 40)
let (X, Y) = meshgrid(x, x)
let size = x.size()
let Z = empty<Float64>(size, size)
for (i in 0..size) {
for (j in 0..size) {
let R = sqrt(pow(X[i,j], 2.0) + pow(Y[i,j], 2.0)) + 1e-10
Z[i,j] = sin(R) / R
}
}
mesh(X, Y, Z)
Result:
.. image:: ../../../tests/imgs/mesh/mesh_1.png :align: center :width: 360
- Plotting the :math:
sin(R)/Rfunction using a mesh, with custom coloring.
::
let x = linspace(-8.0, 8.0, num: 40)
let (X, Y) = meshgrid(x, x)
let size = x.size()
let Z = empty<Float64>(size, size)
for (i in 0..size) {
for (j in 0..size) {
let R = sqrt(pow(X[i,j], 2.0) + pow(Y[i,j], 2.0)) + 1e-10
Z[i,j] = sin(R) / R
}
}
let C = apply2(X, Y, {x: Float64, y: Float64 => x * y})
mesh(X, Y, Z, C)
Result:
.. image:: ../../../tests/imgs/mesh/mesh_2.png :align: center :width: 360
- Plotting with custom palette map and face alpha.
::
let x = linspace(-5.0, 5.0, num: 30)
let (X, Y, Z) = meshgrid(x, x, {x: Float64, y: Float64 => y * sin(x) - x * cos(y)})
mesh(X, Y, Z).palette_map_at_surface(true).face_alpha(0.5)
Result:
.. image:: ../../../tests/imgs/mesh/mesh_3.png :align: center :width: 360
- Plotting with hidden-3d set to false.
::
let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
mesh(X, Y, Z).hidden_3d(false)
Result:
.. image:: ../../../tests/imgs/mesh/mesh_4.png :align: center :width: 360