[Pkg-javascript-commits] [science.js] 56/87: Fix KDE example.
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:12:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
bhuvan-guest pushed a commit to branch master
in repository science.js.
commit 4ddf8a9a34376c01f3fe8ab7a5da33443e9250ee
Author: Jason Davies <jason at jasondavies.com>
Date: Tue Jan 3 13:13:48 2012 +0000
Fix KDE example.
---
examples/kde/kde.js | 10 +++++-----
examples/loess/loess.js | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/examples/kde/kde.js b/examples/kde/kde.js
index bbe83c5..00783b7 100644
--- a/examples/kde/kde.js
+++ b/examples/kde/kde.js
@@ -4,25 +4,25 @@ d3.json("faithful.json", function(faithful) {
var w = 800,
h = 400,
x = d3.scale.linear().domain([30, 110]).range([0, w]);
- bins = d3.layout.histogram().frequency(true).bins(x.ticks(60))(data),
+ bins = d3.layout.histogram().frequency(false).bins(x.ticks(60))(data),
max = d3.max(bins, function(d) { return d.y; }),
y = d3.scale.linear().domain([0, .1]).range([0, h]),
kde = science.stats.kde().sample(data);
var vis = d3.select("body")
- .append("svg:svg")
+ .append("svg")
.attr("width", w)
.attr("height", h);
var bars = vis.selectAll("g.bar")
.data(bins)
- .enter().append("svg:g")
+ .enter().append("g")
.attr("class", "bar")
.attr("transform", function(d, i) {
return "translate(" + x(d.x) + "," + (h - y(d.y)) + ")";
});
- bars.append("svg:rect")
+ bars.append("rect")
.attr("fill", "steelblue")
.attr("width", function(d) { return x(d.dx + 30) - 1; })
.attr("height", function(d) { return y(d.y); });
@@ -33,7 +33,7 @@ d3.json("faithful.json", function(faithful) {
vis.selectAll("path")
.data(d3.values(science.stats.bandwidth))
- .enter().append("svg:path")
+ .enter().append("path")
.attr("d", function(h) {
return line(kde.bandwidth(h)(d3.range(30, 110, .1)));
});
diff --git a/examples/loess/loess.js b/examples/loess/loess.js
index be90f98..67fd5a3 100644
--- a/examples/loess/loess.js
+++ b/examples/loess/loess.js
@@ -13,10 +13,10 @@ var vis = d3.select("#vis")
x: d3.range(n).map(function(i) { return i / n; }),
y: d3.range(n).map(function(i) { return Math.sin(4 * i * Math.PI / n) + (Math.random() - .5) / 5; })
}])
- .append("svg:svg")
+ .append("svg")
.attr("width", w + p + p)
.attr("height", h + p + p)
- .append("svg:g")
+ .append("g")
.attr("transform", "translate(" + p + "," + p + ")");
var loess = science.stats.loess().bandwidth(.2),
@@ -26,7 +26,7 @@ var loess = science.stats.loess().bandwidth(.2),
vis.selectAll("circle")
.data(function(d) { return d3.zip(d.x, d.y); })
- .enter().append("svg:circle")
+ .enter().append("circle")
.attr("cx", function(d) { return x(d[0]); })
.attr("cy", function(d) { return y(d[1]); })
.attr("r", 3);
@@ -35,7 +35,7 @@ vis.selectAll("path")
.data(function(d) {
return [d3.zip(d.x, loess(d.x, d.y))];
})
- .enter().append("svg:path")
+ .enter().append("path")
.attr("d", line);
vis.append("g")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/science.js.git
More information about the Pkg-javascript-commits
mailing list