Skip to content
3D Triangulated Surface

3D Triangulated Surface

trisurf3d() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.

3D Triangulated Surface

Usage

from std.math import cos, sin, sqrt

from dataviz import save, trisurf3d

def main() raises:
    # Illustrative survey: samples off the grid, spread over a
    # disc by the golden angle so the density is even.
    var x = List[Float64]()
    var y = List[Float64]()
    var z = List[Float64]()
    for i in range(400):
        var t = Float64(i) * 2.399963
        var r = 0.16 * sqrt(Float64(i))
        var px = r * cos(t)
        var py = r * sin(t)
        x.append(px)
        y.append(py)
        z.append(0.8 * sin(px * 1.1) * cos(py * 1.1))

    var c = trisurf3d(
        x, y, z, title="Illustrative Survey Sampled Off the Grid"
    )
    save(c, "docs/src/examples/out_trisurf3d.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • x: The numeric column for this channel.
  • y: The numeric column for this channel.
  • z: The numeric column for this channel.
  • elev: See the list overload.
  • azim: See the list overload.
  • theme: See the list overload.
  • width: See the list overload.
  • height: See the list overload.
  • title: See the list overload.
  • subtitle: See the list overload.

Related

Related charts: 3D Wireframe · 3D Bars

Relevant API: trisurf3d