Unlisted
Edited
Aug 6, 2023
Paused
Insert cell
Insert cell
extraProjections = require("d3-geo-projection@4")
Insert cell
Plot.plot({
projection: {
type: ({ width, height }) =>
extraProjections
.geoSinusoidal()
.translate([width / 2, height / 2])
.scale(100)
},
marks: [Plot.graticule({ strokeOpacity: 1 })]
})
Insert cell
Insert cell
Plot.plot({
projection: {
type: ({ width, height }) => {
const radians = (deg) => (Math.PI * deg) / 180;
return d3.geoTransform({
point: function (lon, lat) {
const [lambda, phi] = [radians(lon), radians(lat)];
const scale = 0.15;
this.stream.point(
scale * width * lambda * Math.cos(phi) + width / 2,
scale * width * phi + height / 2
);
}
});
}
},
marks: [Plot.graticule({ strokeOpacity: 1 })]
})
Insert cell
Insert cell
Plot.plot({
projection: {
type: ({ width, height }) => {
return d3
.geoProjection((λ, ϕ) => [λ * Math.cos(ϕ), ϕ])
.fitSize([width, height], { type: "Sphere" });
}
},
marks: [Plot.graticule({ strokeOpacity: 0.5 }), Plot.sphere()]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more