Public
Edited
Jan 25, 2024
1 star
Insert cell
Insert cell
Plot.plot({
width: width, height: width * 3 / 4,
marginRight: 50,
x: {grid: true, type: "log", base: 2},
y: {label: "1/ratio ->", grid: true, type: "log", base: 2},
marks: [
Plot.dot(shortReport, {
x: "Decompression speed",
y: d => 100 / d.Ratio,
fill: "Compressor name",
}),
Plot.text(shortReport, {
x: "Decompression speed",
y: d => 100 / d.Ratio,
text: d => d["Compressor name"],
dy: -5
}),
Plot.line(shortReport, {
curve: 'catmull-rom',
x: "Decompression speed",
y: d => 100 / d.Ratio,
z: d => d["Compressor name"].match(/^\w+/)[0],
stroke: d => d["Compressor name"].match(/^\w+/)[0],
sort: d => Number((d["Compressor name"].match(/-(\d+)$/) || [])[1])
}),
]
})
Insert cell
report = FileAttachment("dhrystone-17-33.csv").csv({typed: true})
Insert cell
report@17.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Inputs.table(report)
Insert cell
report17.forEach(d => d.Ratio = 100 * d["Compressed size"] / d["Original size"]) // update ratios
Insert cell
shortReport = report17.filter(row =>
// true
(row.Ratio < 10)
&& (row.Ratio > 0.3)
// && ((row['Compression speed'] + 900 / row.Ratio) > 700)
// && row['Compression speed'] > 30
// && row['Decompression speed'] > 1000
)
Insert cell
Plot.plot({
width: width, height: width * 3 / 4,
marginRight: 50,
x: {grid: true, grid: true, type: "log", base: 2},
y: {label: "1/ratio ->", grid: true, type: "log", base: 2 },
marks: [
Plot.dot(shortReport, {
x: "Compression speed",
y: d => 100 / d.Ratio,
fill: "Compressor name",
}),
Plot.text(shortReport, {
x: "Compression speed",
y: d => 100 / d.Ratio,
text: d => d["Compressor name"],
dy: -5
}),
Plot.line(shortReport, {
curve: 'catmull-rom',
x: "Compression speed",
y: d => 100 / d.Ratio,
z: d => d["Compressor name"].match(/^\w+/)[0],
stroke: d => d["Compressor name"].match(/^\w+/)[0],
// sort: "Compression speed"
sort: d => Number((d["Compressor name"].match(/-(\d+)$/) || [])[1])

}),
]
})
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