Published
Edited
Mar 12, 2021
1 fork
Insert cell
Insert cell
Insert cell
Table(gapminder)
Insert cell
Insert cell
Table(gapminder2007)
Insert cell
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 100,
data: { values: gapminder2007 },
mark: "tick",
encoding: {
x: { field: "LifeExpectancy", type: "Q" },
size: { value: 100 },
opacity: { value: 0.5 }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 100,
data: { values: gapminder2007 },
mark: "tick",
encoding: {
x: { field: "Population", type: "Q" },
size: { value: 100 },
opacity: { value: 0.5 }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 100,
data: { values: gapminder2007 },
mark: "tick",
encoding: {
x: { field: "Population", type: "Q", scale: { type: "log" } },
size: { value: 100 },
opacity: { value: 0.5 }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 100,
data: { values: gapminder2007 },
mark: "circle",
encoding: {
x: { field: "Population", type: "Q", aggregate: "mean" },
size: { value: 100 },
opacity: { value: 0.5 }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 300,
data: { values: gapminder2007 },
mark: "bar",
encoding: {
x: { field: "LifeExpectancy", type: "Q", bin: { maxbins: 20 } },
y: { aggregate: "count" }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 300,
data: { values: gapminder2007 },
transform: [{ density: "LifeExpectancy", bandwidth: 1 }],
mark: "area",
encoding: {
x: { field: "value", type: "Q" },
y: { field: "density", type: "Q" }
}
})
Insert cell
Insert cell
vegaEmbed({
width: 500,
height: 50,
data: { values: gapminder2007 },
mark: "bar",
encoding: {
x: { field: "LifeExpectancy", type: "Q", bin: { maxbins: 10 } },
y: { aggregate: "count" },
color: { field: "Continent" },
row: { field: "Continent" }
}
})
Insert cell
vegaEmbed({
width: 500,
height: 20,
data: { values: gapminder2007 },
mark: "circle",
encoding: {
x: { field: "Population", type: "Q", scale: { type: "log" } },
color: { field: "Continent", type: "N" },
size: { value: 20 },
opacity: { value: 0.5 },
row: { field: "Continent", type: "N" }
}
})
Insert cell
Insert cell
gapminder = d3.csv(dataUrl, d3.autoType)
Insert cell
gapminder2007 = gapminder.filter(d => d.Year === 2007)
Insert cell
Insert cell
d3 = require("d3@6")
Insert cell
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