Built with blockbuilder.org
Last active
October 2, 2018 19:47
-
-
Save clemsos/eed9cb9fbba4677b86db2bf0dfb4533d to your computer and use it in GitHub Desktop.
Gaussienne
This file contains hidden or 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
license: mit |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
x y z | |
0.44 0.36 1 | |
0.45 0.31 1 | |
0.45 0.33 3 | |
0.45 0.34 2 | |
0.46 0.29 1 | |
0.46 0.30 2 | |
0.46 0.31 5 | |
0.46 0.32 4 | |
0.46 0.33 12 | |
0.46 0.34 5 | |
0.46 0.35 10 | |
0.46 0.36 6 | |
0.47 0.28 1 | |
0.47 0.29 5 | |
0.47 0.30 13 | |
0.47 0.31 19 | |
0.47 0.32 33 | |
0.47 0.33 31 | |
0.47 0.34 24 | |
0.47 0.35 31 | |
0.47 0.36 14 | |
0.47 0.37 6 | |
0.47 0.38 4 | |
0.47 0.40 1 | |
0.48 0.28 5 | |
0.48 0.29 15 | |
0.48 0.30 31 | |
0.48 0.31 49 | |
0.48 0.32 71 | |
0.48 0.33 91 | |
0.48 0.34 73 | |
0.48 0.35 56 | |
0.48 0.36 32 | |
0.48 0.37 20 | |
0.48 0.38 8 | |
0.48 0.39 1 | |
0.48 0.40 1 | |
0.49 0.27 1 | |
0.49 0.28 6 | |
0.49 0.29 20 | |
0.49 0.30 45 | |
0.49 0.31 77 | |
0.49 0.32 130 | |
0.49 0.33 154 | |
0.49 0.34 144 | |
0.49 0.35 129 | |
0.49 0.36 69 | |
0.49 0.37 20 | |
0.49 0.38 7 | |
0.49 0.39 6 | |
0.49 0.40 1 | |
0.50 0.28 10 | |
0.50 0.29 22 | |
0.50 0.30 55 | |
0.50 0.31 90 | |
0.50 0.32 139 | |
0.50 0.33 173 | |
0.50 0.34 141 | |
0.50 0.35 136 | |
0.50 0.36 79 | |
0.50 0.37 42 | |
0.50 0.38 13 | |
0.50 0.39 7 | |
0.50 0.41 2 | |
0.51 0.25 1 | |
0.51 0.27 1 | |
0.51 0.28 12 | |
0.51 0.29 14 | |
0.51 0.30 44 | |
0.51 0.31 90 | |
0.51 0.32 137 | |
0.51 0.33 164 | |
0.51 0.34 152 | |
0.51 0.35 137 | |
0.51 0.36 70 | |
0.51 0.37 42 | |
0.51 0.38 9 | |
0.51 0.39 3 | |
0.51 0.40 2 | |
0.52 0.28 4 | |
0.52 0.29 6 | |
0.52 0.30 30 | |
0.52 0.31 51 | |
0.52 0.32 65 | |
0.52 0.33 83 | |
0.52 0.34 81 | |
0.52 0.35 70 | |
0.52 0.36 54 | |
0.52 0.37 21 | |
0.52 0.38 6 | |
0.52 0.40 1 | |
0.53 0.28 1 | |
0.53 0.29 2 | |
0.53 0.30 12 | |
0.53 0.31 18 | |
0.53 0.32 29 | |
0.53 0.33 40 | |
0.53 0.34 34 | |
0.53 0.35 29 | |
0.53 0.36 19 | |
0.53 0.37 6 | |
0.53 0.38 3 | |
0.53 0.40 1 | |
0.54 0.29 1 | |
0.54 0.30 6 | |
0.54 0.31 6 | |
0.54 0.32 2 | |
0.54 0.33 10 | |
0.54 0.34 4 | |
0.54 0.35 8 | |
0.54 0.36 3 | |
0.54 0.37 1 | |
0.55 0.27 1 | |
0.55 0.32 3 | |
0.55 0.33 2 | |
0.55 0.34 2 | |
0.55 0.35 1 | |
0.55 0.36 1 |
This file contains hidden or 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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
.line { | |
fill: none; | |
stroke: steelblue; | |
stroke-width: 2px; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
var margin = {top: 50, right: 50, bottom: 50, left: 50} | |
, width = 960 - margin.left - margin.right | |
, height = 500 - margin.top - margin.bottom; | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.top + margin.bottom) | |
.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
// Load data | |
d3.tsv('data.csv', function(error, data) { | |
if(error) console.log(error); // check errors | |
console.log(data); | |
// convert text data from CSV to float numbers | |
data.forEach(function(d){ | |
d.x = parseFloat(d.x) | |
d.y = parseFloat(d.y) | |
d.z = parseFloat(d.z) | |
}) | |
var maxX = d3.max(data.map(d=>d.x)) | |
var maxY = d3.max(data.map(d=>d.y)) | |
var maxZ = d3.max(data.map(d=>d.z)) | |
var xScale = d3.scaleLinear() | |
.domain([0, maxX]) // input | |
.range([0, width]); // output | |
var yScale = d3.scaleLinear() | |
.domain([0, maxY]) // input | |
.range([height, 0]); // output | |
// line drawing function | |
var line = d3.line() | |
.x(function(d, i) { return xScale(d.x)); }) // set the x values for the line generator | |
.y(function(d) { return yScale(d.y); }) // set the y values for the line generator | |
.curve(d3.curveMonotoneX) // apply smoothing to the line | |
svg.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(0," + height + ")") | |
.call(d3.axisBottom(xScale)); | |
svg.append("g") | |
.attr("class", "y axis") | |
.call(d3.axisLeft(yScale)); | |
svg.append("path") | |
.datum(data) | |
.attr("class", "line") | |
.attr("d", line); | |
}) | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment