Improving the Y-Axis on Log Scaling

November 2, 2020 > 91-DIVOC-01: "An interactive visualization of the exponential spread of COVID-19"

With the introduction of derivative charts, the new code for log scaling on some graphs (particularly those with large values, like a graph of cumulative deaths) left a lot of whitespace at the bottom of the graph due to x-intercept of the y-axis was “fixed” at starting at 0.001.

Log scales are tricky as they are undefined at 0, so you are unable to start the y-axis labeling as 0 and visualizations are forced to choose a non-zero value. (This differs from a linear scale, where best practices dictate that – unless it’s both obvious to the reader and for a clear reason – an honest visualization will always start with the y-axis at zero.) With today’s update, I’ve implemented new code to calculate the starting value (x-intercept) for the log scales.

In general, the scale for all log graphs will start at the 10x power such that 10x is lower than the lowest positive data point, with two exceptions: