Skip to content

Instantly share code, notes, and snippets.

@jgoodie
Created August 8, 2022 20:16
Show Gist options
  • Save jgoodie/79d2ba636563d69da93d3f3d788b6c90 to your computer and use it in GitHub Desktop.
Save jgoodie/79d2ba636563d69da93d3f3d788b6c90 to your computer and use it in GitHub Desktop.
Add an X and Y axis to the plot
// Add X axis
const x = d3.scaleLinear()
.domain([1.5, 5])
.range([ 0, width ]);
svg.append("g")
.attr("transform", `translate(0, ${height})`)
.call(d3.axisBottom(x));
// Add Y axis
const y = d3.scaleLinear()
.domain([3, 8.5])
.range([ height, 0]);
svg.append("g")
.call(d3.axisLeft(y));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment