Published
Edited
Oct 5, 2022
Insert cell
Insert cell
key = Swatches(chart.scales.color)
Insert cell
chart = ForceGraph(imdb_data_100, {
width: width,
height: 800,
nodeGroup: d => d.group,
nodeRadius: d => radius.get(d.id) * 3,
nodeTitle: d => `${d.id}: ${radius.get(d.id)}`
})
Insert cell
radius = {
const degree = new Map();
imdb_data_100.nodes.forEach(d => {
degree.set(d.id, 1)
})

imdb_data_100.links.forEach(d => {
degree.set(d.target, degree.get(d.target)+1)
})

return degree
}
Insert cell
imdb_data_100 = FileAttachment("imdb_data_100.json").json()
Insert cell
Insert cell
import {Swatches} from "@d3/color-legend"
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