Public
Edited
Oct 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function notesInKey(key, type) {
return type.map(note => {
if (!type) { return -1; }
return (note + key) % 12;
});
}
Insert cell
function namesInKey(key, type) {
return notesInKey(key, type).map(note => names[note]);
}
Insert cell
function fingersInKey(key, type) {
return notesInKey(key, type).map(note => fingers[note]);
}
Insert cell
function complexity(key, type) {
let total = 0;
let fingers = fingersInKey(key, type);
fingers.forEach(f => total += (f instanceof Array ? f.length : 0));
return total;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
complexityDataMajor = names.map((name, index) => {
return {
key: name,
complexity: complexity(index, major)
}
});
Insert cell
complexityDataMinor = names.map((name, index) => {
return {
key: name,
complexity: complexity(index, minor)
}
});
Insert cell
Plot.plot({
x: {padding: 0.4},
marks: [
Plot.barY(complexityDataMajor, {x: "key", y: "complexity", dx: 8, fill: "green"}),
Plot.barY(complexityDataMinor, {x: "key", y: "complexity", dx: -8, fill: "orange"})
]
})
Insert cell
Select a data source…
Type Table, then Shift-Enter. Ctrl-space for more options.

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