• Stars
    star
    156
  • Rank 231,261 (Top 5 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Interactive 3D / 2D webgl-accelerated scatter plot point renderer

ScatterGL

Interactive 3D / 2D webgl-accelerated scatter plot point renderer. Core functionality from the embedding projector, capable of rendering and interacting with tens of thousands of points.

Examples

Basic use

// where `points` is an array of 2 or 3-dimensional points as number arrays.
const dataset = new ScatterGL.Dataset(points);
const scatterGL = new ScatterGL(containerElement);
scatterGL.render(dataset);

Installation

with yarn / npm
yarn add scatter-gl
via cdn
<!-- Load three.js -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js"></script>
<!-- Load scatter-gl.js -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/scatter-gl.min.js"></script>

Parameters

The ScatterGL constructor can accept a number of parameters via a ScatterGLParams object:

Parameter Type Description default
camera Camera An object containing default parameters for the camera Camera params object (zoom: number, target: Point3D, and position: Point3D)
onClick (point: Point | null) => void A callback invoked when clicking on a point or elsewhere
onHover (point: Point | null) => void A callback invoked when hovering over a point
onSelect (points: Point[]) => void A callback invoked when a point or points are selected
onCameraMove (cameraPosition: THREE.Vector3, cameraTarget: THREE.Vector3) => void A callback invoked the camera moves due to user interaction.
pointColorer `(index: number, selectedIndices: Set, hoverIndex: number null) => string` A function to determine the color of points
renderMode RenderMode The render mode to display points, one of RenderMode.POINT, RenderMode.SPRITE, or RenderMode.TEXT RenderMode.POINT
showLabelsOnHover boolean Whether or not to render label text on hover true
selectEnabled boolean true Whether or not a user can select points by clicking
styles Styles An object containing style parameters to override the default options
rotateOnStart boolean Whether or not the renderer automatically rotates until interaction true
orbitControls OrbitControlParams An object containing default parameters for the orbit controls Orbit Controls params object (zoomSpeed: number, autoRotateSpeed: number, and mouseRotateSpeed: number)

ScatterGL methods

Method Description
isOrbiting() Returns whether the orbit animation is currently on
render(dataset: Dataset) Initializes and renders a dataset to the container element
resize() Updates the render size based on the container element
resetZoom() Resets the camera zoom to default
select(pointIndices: number[]) Selects points by index
setPanMode() Sets interaction mode to 'pan'
setPointColorer(pointColorer: PointColorer) Sets a function to determine colors
setHoverPointIndex() Sets the hovered point
setPointRenderMode() Sets point render mode
setRenderMode(renderMode: RenderMode) Sets a specific render mode
setSelectMode() Sets interaction mode to 'select'
setSequences(sequences: Sequence[]) Sets sequences with which to render polylines
setSpriteRenderMode() Sets sprite render mode
setTextRenderMode() Sets text render mode
updateDataset(dataset: Dataset) Updates the dataset
startOrbitAnimation() Begin rotating until an interaction
stopOrbitAnimation() Stops automatic rotation

ScatterGL Styles

See styles.ts for interfaces and descriptions of a user-configurable styles object that can be provided to ScatterGL to configure colors, sizes, fog, etc.

Advanced usage

See the demo app for examples of interaction handling, spritesheet rendering, and point coloring.

Styling

You can provide an object in the form of Styles via the styles parameter of the ScatterGLParams object.

Development

yarn
yarn demo

This is not an officially supported Google product

More Repositories

1

facets

Visualizations for machine learning datasets
Jupyter Notebook
7,308
star
2

lit

The Learning Interpretability Tool: Interactively analyze ML models to understand their behavior in an extensible and framework agnostic interface.
TypeScript
3,386
star
3

saliency

Framework-agnostic implementation for state-of-the-art saliency methods (XRAI, BlurIG, SmoothGrad, and more).
Jupyter Notebook
927
star
4

what-if-tool

Source code/webpage/demos for the What-If Tool
HTML
881
star
5

umap-js

JavaScript implementation of UMAP
JavaScript
344
star
6

knowyourdata

A tool to help researchers and product teams understand datasets with the goal of improving data quality, and mitigating fairness and bias issues.
CSS
273
star
7

wordcraft

โœจโœ๏ธ Wordcraft is an AI-powered text editor with an emphasis on short story writing
TypeScript
208
star
8

federated-learning

Federated learning experiment using TensorFlow.js
TypeScript
159
star
9

datacardsplaybook

The Data Cards Playbook helps dataset producers and publishers adopt a people-centered approach to transparency in dataset documentation.
TypeScript
157
star
10

understanding-umap

Understanding the theory behind UMAP
JavaScript
150
star
11

interpretability

PAIR.withgoogle.com and friend's work on interpretability methods
JavaScript
109
star
12

ai-explorables

https://pair.withgoogle.com/explorables/
Jupyter Notebook
51
star
13

cococo

๐„ก Collaborative Convolutional Counterpoint
TypeScript
45
star
14

cam-scroller

Cam Scroller is an open-source Chrome extension that uses your webcam and deeplearn.js to enable scrolling through webpages using custom gestures that you define.
JavaScript
33
star
15

font-explorer

Font latent space explorer using tensorflow.js
Vue
31
star
16

clinical-vis

A javascript medical record visualization (https://arxiv.org/abs/1810.05798)
HTML
25
star
17

megaplot

TypeScript
19
star
18

pair-code.github.io

HTML
17
star
19

depth-maps-art-and-illusions

TypeScript
16
star
20

thehardway

Supplementary code repository to accompany Tic-Tac-Toe the Hard Way podcast
JavaScript
11
star
21

covid19_symptom_dataset

JavaScript
11
star
22

recommendation-rudders

TypeScript
10
star
23

jax-recommenders

Python
8
star
24

farsight

In situ interactive widgets for responsible AI ๐ŸŒฑ
TypeScript
7
star
25

book-viz

Visualizing multilevel structure in books with sentence embeddings.
Jupyter Notebook
6
star
26

waterfall-of-meaning

TypeScript
4
star
27

tiny-transformers

Jupyter Notebook
4
star
28

deeplearnjs-legacy-loader

Deprecated: Legacy TensorFlow model loader for deeplearn.js
Python
3
star
29

colormap

JavaScript
3
star
30

ml-vis-experiments

Jupyter Notebook
1
star
31

deeplearnjs-docs

TypeScript
1
star
32

auto-histograms

Python
1
star