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

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