Skip to content

Point Visual

The Point visual renders circular, borderless filled discs at 2D or 3D positions. It provides a simple and efficient way to visualize large sets of unstyled points.

Point visual

Overview

  • Renders filled circular discs
  • Per-vertex: position, color, size
  • No border, shape, or texture

When to use

Use the point visual when:

  • You need basic, fast scatter plots with custom colors and sizes
  • You don’t need symbolic shapes or outlines (use Marker for that)
  • You want simple 3D point clouds with minimal overhead (but more overhead than Pixel)

Attributes

Per-item

Attribute Type Description
position (N, 3) float32 3D positions in NDC space
color (N, 4) uint8 Per-point RGBA color
size (N,) float32 Per-point diameter in pixels

All attributes are per-vertex and required.


Example

import numpy as np

import datoviz as dvz


def generate_data():
    grid_x = 16
    grid_y = 12
    N = grid_x * grid_y

    # Grid coordinates in [-1, 1]
    x = np.linspace(-1, 1, grid_x)
    y = np.linspace(-1, 1, grid_y)
    X, Y = np.meshgrid(x, y)
    x_flat = X.flatten()
    y_flat = Y.flatten()
    z_flat = np.zeros_like(x_flat)

    positions = np.stack([x_flat, y_flat, z_flat], axis=1).astype(np.float32)
    positions *= 0.90  # margin

    # Hue along x-axis
    hue = (x_flat + 1) / 2
    colors = dvz.cmap('hsv', hue)

    # Size: exponential growth from 10px to 50px along y-axis
    y_norm = (y_flat + 1) / 2
    sizes = 10 * 4.0**y_norm
    sizes = sizes.astype(np.float32)

    return N, positions, colors, sizes


N, position, color, size = generate_data()

app = dvz.App()
figure = app.figure()
panel = figure.panel()
panzoom = panel.panzoom()

visual = app.point(position=position, color=color, size=size)
panel.add(visual)

app.run()
app.destroy()

Summary

The point visual is the fastest way to render a large number of colored, sized circular points.

  • ✔️ Efficient for scatter plots and point clouds
  • ✔️ Fully GPU-accelerated
  • ❌ No support for borders, shapes, or textures (use Marker instead)