Skip to content

dvdkouril/scattered

Repository files navigation

scattered: a composable library for 3D scatterplots

3D scatterplots probably suck, but they're much more fun than regular scatterplots!

Caution

This project is as Work-In-Progress as it gets.

teaser

The basic idea is:

  • arrow/dataframe as input (with 'x', 'y', 'z' columns)
  • minimal dependencies & small bundle size
  • webgpu rendering
  • javascript library (npm), jupyter widget (pypi), web page (like quak)

use in python

Install:

uv add scattered

or: pip install scattered

Then use:

import scattered
import numpy as np
import pandas as pd

df = pd.DataFrame({
    "x": np.random.rand(5),
    "y": np.random.rand(5),
    "z": np.random.rand(5),
})

scattered.Widget(df)

use in javascript

Install:

pnpm add scattered

or: npm install scattered or yarn add scattered

Then use:

import * as sctrd from "scattered";

const url = "https://raw.githubusercontent.com/dvdkouril/sample-3d-scatterplot-data/main/penguins.arrow";
const c = sctrd.display(url,
    { // encoding
        x: "x",
        y: "y",
        z: "z",
        color: "category",
    });

let appEl = document.querySelector('#app');
if (c) {
    appEl.appendChild(c);
}

about

This project is developed by David Kouřil (web, bsky).

why

I think we're missing a modern, simple to use library for interactive 3D scatterplots. Visualization libraries are typically centered around 2D plots to make exporting as vector graphics easier.

However, learning is the primary motivation:

  1. learn a bit of webgpu
  2. explore the composability principles for visualization tools
  3. learn about bundling, and how to maintain multi-package project

scattered is very much inspired by quak and also follow the structure of that repo.

related and inspo

From researching 3D scatterplots in the wild.

About

3D scatterplots in notebooks and on web

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors