Skip to main content
100%

Axis Labels

✓ Published10🌍 Public
CCurran Kelleher
Last edited Jan 30, 2024
Created on Jan 24, 2024
Forked from Scales and Axes

This example demonstrates how to add descriptive labels to both the X and Y axes of a basic scatter plot-like visualization. It uses D3.js to render and position text elements alongside the axis ticks generated with `d3.axisBottom` and `d3.axisLeft`. The code builds a linear scale for each axis, draws a gray inner rectangle as the plotting area, and places the axis labels with configurable offsets using SVG text elements. The visualization accepts parameters for label text, offsets, and margins, making it a reusable template for labeling axes in larger projects.

AI-generated description

Adding labels to our X and Y axes with D3.

MIT Licensed

Similar vizzes