Skip to content

Commit

Permalink
Fix #38 - better defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jun 19, 2016
1 parent 4a6d40a commit 973961b
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/projection/albers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import conicEqualArea from "./conicEqualArea";

export default function() {
return conicEqualArea()
.rotate([96, 0])
.center([-0.6, 38.7])
.parallels([29.5, 45.5])
.scale(1070);
.scale(1070)
.translate([480, 250])
.rotate([96, 0])
.center([-0.6, 38.7]);
}
4 changes: 3 additions & 1 deletion src/projection/azimuthalEqualArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ azimuthalEqualArea.invert = azimuthalInvert(function(z) {
});

export default function() {
return projection(azimuthalEqualArea);
return projection(azimuthalEqualArea)
.scale(120)
.clipAngle(180 - 1e-3);
}
6 changes: 4 additions & 2 deletions src/projection/azimuthalEquidistant.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {acos, sin} from "../math";
import {acos, sin, tau} from "../math";
import {azimuthal, azimuthalInvert} from "./azimuthal";
import projection from "./index";

Expand All @@ -11,5 +11,7 @@ azimuthalEquidistant.invert = azimuthalInvert(function(z) {
});

export default function() {
return projection(azimuthalEquidistant);
return projection(azimuthalEquidistant)
.scale(480 / tau)
.clipAngle(180 - 1e-3);
}
4 changes: 3 additions & 1 deletion src/projection/conicEqualArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ function conicEqualArea(y0, y1) {
}

export default function() {
return conicProjection(conicEqualArea);
return conicProjection(conicEqualArea)
.scale(151)
.translate([480, 347]);
}
4 changes: 3 additions & 1 deletion src/projection/conicEquidistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ function conicEquidistant(y0, y1) {
}

export default function() {
return conicProjection(conicEquidistant);
return conicProjection(conicEquidistant)
.scale(128)
.translate([480, 280]);
}
4 changes: 3 additions & 1 deletion src/projection/gnomonic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ function gnomonic(x, y) {
gnomonic.invert = azimuthalInvert(atan);

export default function() {
return projection(gnomonic);
return projection(gnomonic)
.scale(139)
.clipAngle(70);
}
4 changes: 2 additions & 2 deletions src/projection/mercator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import projection from "./index";
import {atan, exp, halfPi, log, pi, tan} from "../math";
import {atan, exp, halfPi, log, pi, tan, tau} from "../math";

export function mercator(lambda, phi) {
return [lambda, log(tan((halfPi + phi) / 2))];
Expand Down Expand Up @@ -38,5 +38,5 @@ export function mercatorProjection(project) {
return m;
};

return m.clipExtent(null);
return m.clipExtent(null).scale(961 / tau);
}
6 changes: 4 additions & 2 deletions src/projection/orthographic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {asin, cos, sin} from "../math";
import {asin, cos, epsilon, sin} from "../math";
import {azimuthalInvert} from "./azimuthal";
import projection from "./index";

Expand All @@ -9,5 +9,7 @@ function orthographic(x, y) {
orthographic.invert = azimuthalInvert(asin);

export default function() {
return projection(orthographic);
return projection(orthographic)
.scale(240)
.clipAngle(90 + epsilon);
}
4 changes: 3 additions & 1 deletion src/projection/stereographic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ stereographic.invert = azimuthalInvert(function(z) {
});

export default function() {
return projection(stereographic);
return projection(stereographic)
.scale(240)
.clipAngle(180 - 1e-3);
}

0 comments on commit 973961b

Please sign in to comment.