Public
Edited
Jul 3, 2024
1 fork
7 stars
Insert cell
Insert cell
// patch the spec to add the signal for rotation
viewof view = embed(vlSpec, {patch: [{
path: "/signals",
op: "add",
value: [{
name: "rotation",
value: 0,
}]
}]})
Insert cell
Insert cell
Insert cell
vlSpec = ({
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"width": 500,
"height": 500,
"data": {
"url": "https://unpkg.com/world-atlas@1/world/110m.json",
"format": {
"type": "topojson",
"feature": "countries"
}
},
"projection": {
"type": "orthographic",
// this is a hack!
"rotate": [{"signal": "rotation"},0,0]
},
"mark": {
"type": "geoshape",
"fill": "lightgray",
"stroke": "black",
"strokeWidth": 0.5
}
})
Insert cell
// update the view when the rotation changes
view.signal('rotation', rotation).run()
Insert cell
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