3D WebGL scatter plots with custom point glyphs.
var createScene =var createPoints =var scene =var initialData =gl: sceneglposition: 1 0 -1 0 1 -1 0 0 1 11-1 101 011glyph: "▼" "★" "■" "◆" "✚" "✖"color: 010 001 110 101 011 000size: 12orthographic: trueforvar i=0; i<100; ++ivar theta = i / 1000 * 20 * MathPIvar x = Mathvar y = MathinitialDatapositioninitialDataglyphinitialDatacolorvar points =scene
npm install gl-scatter3d
var points = require('gl-scatter3d')(options)
Constructs a scatter plot with the given parameters.
options is an object with the following properties:
glis a WebGL context
position(Required) an array of length 3 arrays encoding the position of the points in the scatter plot.
colorA length 3 array encoding the color of the points in the scatter plot. To set colors per point, pass an array instead. Default is
glyphThe glyph of each point. This is a UTF8 string representing some shape. Per point glyphs can be specified by passing an array. The default glyph is a circle,
"●". For more glyph ideas, check out the unicode character set. Some other fun suggestions:
"☢", "☯", "❤", "▲", "⚑".
sizeThe size of each point, or specified per-point using an array. In orthographic, this is in screen coordinates, or in perspective this is in world coordinates. Default is
orthographicA flag, which if set to
truecauses the points to be drawn without perspective scaling.
lineWidththe width of the outline (set to 0 for no outline) Default is
lineColorthe color of the outline for each marker
fontthe font used for drawing the glyphs (default
anglean angle to rotate the glyphs by in radians (default
alignmenta 2d vector to offset text drawing by (default
projecta flag (or array of flags) which determines which axes to project onto
projectOpacitythe opacity of the projected point sprites (default
projectScalethe scaling factor of the projected point sprites (default
Returns A new scatter plot object
Updates the scatter plot object. The parameter
options has the same properties as the constructor.
The opacity of the point set (default 1)
A factor by which projections are rescaled
The opacity of the projected points
An array of projection values for each point
The width of the outline of each point
(c) 2014-2015 Mikola Lysenko. MIT License. Supported by plot.ly