Skip to content

Commit 13f486d

Browse files
committed
Add script to generate plot
1 parent d0ca8bf commit 13f486d

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/datasets/cdc-nchs-us-infant-mortality-bw-1915-2013/scripts
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var Plot = require( '@stdlib/plot/ctor' );
24+
var dataset = require( './../lib' );
25+
26+
27+
// MAIN //
28+
29+
/**
30+
* Main execution sequence.
31+
*
32+
* @private
33+
*/
34+
function main() {
35+
var data;
36+
var plt;
37+
var N;
38+
var x;
39+
var i;
40+
41+
// Load the dataset:
42+
data = dataset();
43+
44+
// Generate x-axis data:
45+
N = data.black.length;
46+
x = [];
47+
for ( i = 0; i < N; i++ ) {
48+
x.push( 1915+i );
49+
}
50+
51+
// Create a new plot:
52+
plt = new Plot( [ x, x ], [ data.black, data.white ] );
53+
plt.width = 560;
54+
55+
plt.title = 'Infant Mortality Rate, Black vs White (1915-2013)';
56+
plt.xLabel = 'Year';
57+
plt.yLabel = 'Infant Mortality Rate';
58+
59+
plt.xTickFormat = 'd';
60+
61+
plt.view( 'window' );
62+
}
63+
64+
main();

0 commit comments

Comments
 (0)