Published
Edited
Feb 5, 2018
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
stdlib = require( "https://unpkg.com/@stdlib/stdlib@0.0.32/dist/stdlib-flat.min.js" )
Insert cell
Insert cell
Insert cell
stdlib.base.erf( 0.5 )
Insert cell
Insert cell
x = stdlib.linspace( -2.5, 2.5, 500 )
Insert cell
Insert cell
function erf( x ) {
var y = [];
var i;
for ( i = 0; i < x.length; i++ ) {
y.push( stdlib.base.erf( x[ i ] ) );
}
return y;
}
Insert cell
Insert cell
y = erf( x )
Insert cell
Insert cell
plt = stdlib.plot( [x], [y] )
Insert cell
Insert cell
{
plt.yMin = -1.1;
plt.yMax = 1.1;
}
Insert cell
Insert cell
plt.colors = [ 'orange' ]
Insert cell
Insert cell
plt.title = 'Error Function'
Insert cell
Insert cell
plt.yLabel = 'erf'
Insert cell
Insert cell
out = plt.render()
Insert cell
Insert cell
vdom2html = require( "https://wzrd.in/standalone/vdom-to-html@2.1.1" )
Insert cell
Insert cell
str = vdom2html( plt.render() )
Insert cell
Insert cell
html`${str}`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more