Created
December 4, 2015 15:05
-
-
Save domitry/9b06a4e0fb7812692d45 to your computer and use it in GitHub Desktop.
to_png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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