Public
Edited
Nov 29, 2023
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 300,
height: 300,
x: {
domain: [1,2,3]
},
y: {
domain: [1,2,3]
},
marks: [
Plot.dot(matrixSample, { x: "x", y: "y"}),
Plot.ruleX([1,2,3], { stroke: "cyan"}),
Plot.ruleY([1,2,3], { stroke: "pink"})
]
})
Insert cell
Insert cell
Insert cell
createArray = (n) => d3.range(1, n + 1)
Insert cell
createArray(10)
Insert cell
Insert cell
calculateIconLayout(10,102)
Insert cell
Insert cell
createDeepMatrix = (iconsPerRow, totalIcons) => calculateIconLayout(iconsPerRow, totalIcons).map((d, i) =>
createArray(d).map((t) => {
return { x: t, y: i+1 }
})
)
Insert cell
Insert cell
createMatrixData(10,100)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
createIconMatrixPlot(iconsPerRow, iconsTotal, iconsFilled)
Insert cell
Insert cell
testData = createMatrixData(10,100)
Insert cell
Insert cell
Plot.plot({
y: {
reverse: true
},
color: {
domain: ["silver", "bronze", "gold"], // data
range: ["#dcdcdc", "brown", "red"] // color
},
marks: [
Plot.dot(typeMatrix, { x: "x", y: "y", fill: "type", r: 10, symbol: "star" }),
// Plot.text(testData, { x: d => d.x, y: d => d.y, text: d => `(${d.x}, ${d.y})` })
]
})
Insert cell
import {olympics2020, medals} from "@datavizstudio/isotype-pictogram-demo"
Insert cell
Insert cell
import {olympicsMatrixData} from "@datavizstudio/person-isotype-matrix-source"
Insert cell
olympics2020
Insert cell
olympicsMatrixData
Insert cell
ranking = d3.sort(olympicsMatrixData, d => d.Gold).map(d => d.nation)
Insert cell
Plot.plot({
margin: 30,
width: width,
y: {
reverse: true
},
fx: {
domain: ranking
},
marks: [
// Plot.dot(olympicsMatrixData, { x: "x", y: "y", fill: "type", r: 5, fx: "nation"}),
// Plot.frame(),
Plot.text(olympicsMatrixData, { x: d => d.x, y: d => d.y, text: d => medals[d.type], fontSize: 15, fx: "nation"})
]
})
Insert cell
import {Scrubber} from '@mbostock/scrubber'
Insert cell
flags = ({ USA: "🇺🇸", CHN: "🇨🇳", JPN: "🇯🇵", GBR: "🇬🇧", ROC: "🇷🇺", AUS: "🇦🇺", GER: "🇩🇪", NED: "🇧🇷", ITA: "🇦🇷", FRA: "🇫🇷", })
Insert cell
nations = d3.sort(olympics2020, d => -d.Gold).map(d => d.nation)
Insert cell
Insert cell
Plot.plot({
title: `2020 Olympics medal counts for ${nationLoop} ${flags[nationLoop]}`,
subtitle: "2020 Olympics top 10 nations medal counts",
margin: 60,
y: {
label: null,
axis: null,
reverse: true
},
x: {
label: null,
axis: null,
domain: createArray(10), // [1, 2, 3..., n]
},
marks: [
Plot.text(olympicsMatrixData, { x: "x", y: "y", text: d => medals[d.type], fontSize: 20, filter: d => d.nation === nationLoop})
]
})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more