Data Visualization

Overlays & Scatter Clouds

Annotate world space with labels, lines, and polylines, or use Label3D as a batch point primitive for depth-sorted 3D scatter clouds.

Updated Publisher Alien_AlgorithmsPine Script v6

Overlay primitives

TypeUse
Label3DText, glyphs, tooltips, point markers, and scatter samples.
Line3DOne world-space segment with line style and width.
Polyline3DAn ordered 3D path with optional closure and fill.

Always use named arguments

World-space overlayspine
p3d.Label3D tagLabel = p3d.Label3D.new(
  position = p3d.vec3(0, 80, 0), txt = "Peak", textColor = color.white)
scene.add(tagLabel)

p3d.Line3D axis = p3d.Line3D.new(
  start = p3d.vec3(0, 0, 0), end = p3d.vec3(0, 100, 0),
  col = color.yellow, width = 2)
scene.add(axis)

array<p3d.Vec3> pts = array.from(
  p3d.vec3(0, 0, 0), p3d.vec3(50, 30, 0), p3d.vec3(100, 0, 50))
p3d.Polyline3D path = p3d.Polyline3D.new(points = pts, col = color.aqua, width = 2)
scene.add(path)
Use named UDT arguments
Overlay types expose many fields. Named construction prevents field-order mistakes and keeps examples readable across library updates.

Methods and mutable fields

  • Label3D: move, text, color, tooltip, visibility, tag, background, style, size, and font.
  • Line3D: endpoints, color, width, solid/dashed/dotted or arrow line style, visibility, and tag.
  • Polyline3D: points, color, fill, width, closure, solid/dashed/dotted style, visibility, and tag.

TradingView polylines do not support arrow line styles. Use Line3D for arrow-ended segments.

Scatter clouds with Label3D

Batch 3D point cloudpine
var array<p3d.Label3D> points = array.new<p3d.Label3D>()

if barstate.isfirst
    for i = 0 to 499
        points.push(p3d.Label3D.new(
          position = p3d.vec3(0.0, 0.0, 0.0), txt = "•"))
    scene.add(points)

if barstate.islast
    for i = 0 to points.size() - 1
        float t = i * 0.05 + bar_index * 0.01
        p3d.Label3D point = points.get(i)
        point.position := p3d.vec3(
          80.0 * math.cos(t), i * 0.4 - 100.0, 80.0 * math.sin(t))
        point.textColor := i % 2 == 0 ? color.aqua : color.fuchsia
    p3d.render(scene)

Batch addition supports up to 500 points, each with independent position, symbol, label style, size, color, and tooltip. The renderer reads field mutations every frame.

Use cases

Classification clouds, K-means clusters, particles, point-sampled parametric surfaces, and colored attractors.

Ground grid helper

wireGrid(scene, width, depth, divX, divZ, color) adds a depth-sorted ground grid that participates in the same camera projection and scene ordering.

Pine3D is a graphical rendering library for Pine Script. TradingView drawing, execution, and publication limits still apply. © Alien_Algorithms.