Drawing the Axis

We'll look at a few special ways we can refine an axis's appearance by removing the outer ticks.

We'll cover the following

We are going to draw an axis to help us read the data. The states should be drawn across the x-axis. The population should be drawn on the y-axis. If you would like, try adding an axis as an exercise. You already know how to accomplish this task. Try tackling this challenge before proceeding.


If you were able to draw the axes, then that is great. If not, that is fine, too. We will draw the axes together. We will be working at the bottom of the draw() function.

The first step is to create the functions for drawing the axes. We will define a variable called xAxis. It will be set to the d3.axisBottom function.

Get hands-on with 1200+ tech skills courses.