Skip to content

Instantly share code, notes, and snippets.

@domitry

domitry/index.html

Created Dec 4, 2015
Embed
What would you like to do?
to_png
<html>
<head>
<title>Line with Nyaplotjs</title>
<script src='https://cdn.rawgit.com/domitry/Nyaplotjs/1d2e51d061312c82e8db7ff7a04ee85fdc4ef2c0/release/nyaplot.min.js'></script>
<script>
var xarr=[], yarr1=[], yarr2=[], N=500, curry1=0.0, curry2=0.0;
for(var i=0;i < N;i++){
xarr.push(i);
yarr1.push(curry1+=(Math.random()-0.5));
yarr2.push(curry2+=(Math.random()-0.5));
}
var plot = new Nyaplot.Simple.Plot();
plot.line(xarr, yarr1, {color: "#66c2a5"});
plot.line(xarr, yarr2, {color: "#fc8d62"});
plot.title("Random walk");
plot.xlabel("Number of steps");
plot.render("#vis");
plot.to_png("#to_png");
</script>
</head>
<body>
<h2>
Plot#parse
</h2>
<div id="vis"></div>
<h2>
Plot#to_png
</h2>
<div id="to_png"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment