Skip to content

3D Line

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

3D Line

Usage

from std.math import cos, sin

from dataviz import plot3d, save

def main() raises:
    # Illustrative trajectory: a spiral tightening as it climbs.
    var x = List[Float64]()
    var y = List[Float64]()
    var z = List[Float64]()
    for i in range(200):
        var t = Float64(i) * 0.1
        var r = 1.0 - Float64(i) * 0.004
        x.append(r * cos(t))
        y.append(r * sin(t))
        z.append(Float64(i) * 0.02)

    var c = plot3d(
        x, y, z, title="Illustrative Tightening Spiral Trajectory"
    )
    save(c, "docs/src/examples/out_plot3d.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 Scatter · 3D Surface

Relevant API: plot3d