Published
Edited
Feb 27, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = FileAttachment("week_08@1.csv").csv({typed: true})
Insert cell
xAccessor = d => d.CL
Insert cell
yAccessor = d => d.PR
Insert cell
sizeAccessor = d => d.N
Insert cell
xScale = d3.scaleBand()
.domain(d3.range(1, d3.max(data, xAccessor) + 1))
.range([bounded_width, 0])
Insert cell
yScale = d3.scaleBand()
.domain(d3.range(1, d3.max(data, yAccessor) + 1))
.range([0, bounded_height])
Insert cell
sizeScale = d3.scaleSqrt()
.domain(d3.extent(data, sizeAccessor))
.range([8, 20])
Insert cell
scaleColor = d3.scaleSequential()
.domain(d3.extent(data, xAccessor))
.interpolator(d3.interpolateRgb("#1dbde6", "#f1515e"))
Insert cell
chart_width = 500
Insert cell
chart_height = chart_width
Insert cell
bounded_width = chart_width - margin.left - margin.right
Insert cell
bounded_height = chart_height - margin.top - margin.bottom
Insert cell
margin = ({top: 30, right: 10, bottom: 10, left: 50})
Insert cell
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400,700&display=swap');

h1, label, input {
font-family: "Roboto Condensed"
}
text {
font-family: "Roboto Condensed";
}
</style>
Insert cell
d3 = require("d3@7")
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