-
-
Notifications
You must be signed in to change notification settings - Fork 806
/
Copy pathscatter
executable file
·47 lines (41 loc) · 982 Bytes
/
scatter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
'use strict';
var randn = require( '@stdlib/random/base/box-muller' );
var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
var Plot = require( './../lib' );
var plot;
var opts;
var x1;
var x2;
var y1;
var y2;
var i;
// Create some data...
x1 = new Float64Array( 1000 );
x2 = new Float64Array( x1.length );
y1 = new Float64Array( x1.length );
y2 = new Float32Array( x1.length );
for ( i = 0; i < x1.length; i++ ) {
x1[ i ] = 30.0 + (7.5*randn());
x2[ i ] = 40.0 + (12.5*randn());
y1[ i ] = 50.0 + (10.0*randn());
y2[ i ] = 30.0 + (5.0*randn());
}
// Define the plot options:
opts = {
'width': 600,
'height': 480,
'xMin': 0.0,
'xMax': 100.0,
'yMin': 0.0,
'yMax': 100.0,
'lineStyle': 'none',
'symbols': 'closed-circle',
'symbolsSize': 6,
'symbolsOpacity': 0.2
};
// Create a new plot:
plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts );
// View the plot in a window:
plot.view( 'window' );