Skip to main content
100%

Log Axis with Zero

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on May 8, 2013

A log axis with zero uses a secondary ordinal scale to render the value 0 below the main logarithmic scale, which otherwise would place zero at negative infinity. The example shows a horizontal axis with major ticks from 1e-1 to 1e4, plus a separate zero tick offset slightly to the left. It uses d3.svg.axis with a d3.scale.log for the main axis and a d3.scale.ordinal for the zero position, drawing both as SVG groups. The discontinuity is visually encoded by separating the zero tick from the logarithmic scale’s continuous range.

AI-generated description

You might reserve a special place to render zeroes when using a log axis, since normally these will be displayed at infinity. However, since this represents a discontinuity in the encoding, it’s important to show the discontinuity visually.

gpl-3.0 Licensed

Similar vizzes