continuum between linear and logarithmic

A friend and I are working on a heatmap representing some population numbers. Initially we used a linear color scale by default. Then, because the numbers covered a wide range, I tried using a log color scale (as shown here). My friend said it obscured the data too much.

So I was wondering, is there a something in between ... some sort of continuum between linear scale and log scale? Can I drag a slider (so to speak) between linear and log scale? E.g. we might try "25% log and 75% linear".

I guess I could use a linear interpolation function like

f(x) = x + (log(x) - x) * L

where L is "loggishness," ranging from 0 to 1, to interpolate between a linear and a log scale.

I guess there's nothing wrong with that, but it seems ... I don't know, a bit "unnatural." Like it doesn't fit the nature of the log function. Is there a more natural way to do this?

On second thought, I could also try geometric interpolation between x and log(x). That seems to be a little more in keeping with the nature of logarithms, but ... I'm still not sure if it's "the" natural way to do it. I'm also wondering whether it would be visually misleading at all (assuming that we tell the reader what kind of scale we're using).

Am I wrong to try to display data on a somewhat/more/less loggish scale? I couldn't find anyone else talking about it on the web, but maybe I just didn't know what terms to search for.


The integral of $x^n$ for $n\ne-1$ is $x^{n+1}/(n+1)$ (plus a constant), and the integral of $x^{-1}$ is $\log x$, so in a sense $\log x$ acts like $x^0$. Let's say you want to map $x_0$ to $y_0$ and $x_1$ to $y_1$, and you want the values in between to be something in between

$$y=y_0+\frac{x-x_0}{x_1-x_0}(y_1-y_0)$$

and

$$y=y_0+\frac{\log x-\log x_0}{\log x_1-\log x_0}(y_1-y_0)\;,$$

where the $x$ values might be population numbers and the $y$ values might be colour values. Then you can consider $\log x$ as the limit of $x^n/n$ as $n\to0$ and write

$$y=y_0+\frac{x^n-x_0^n}{x_1^n-x_0^n}(y_1-y_0)$$

for arbitrary $n\in[0,1]$, where $n=0$ is understood to mean the limit as $n\to0$. Indeed, by l'Hôpital

$$\lim_{n\to0}\frac{x^n-x_0^n}{x_1^n-x_0^n}=\lim_{n\to0}\frac{\frac{\mathrm d}{\mathrm dn}\left(x^n-x_0^n\right)}{\frac{\mathrm d}{\mathrm dn}\left(x_1^n-x_0^n\right)}=\lim_{n\to0}\frac{x^n\log x-x_0^n\log x_0}{x_1^n\log x_1-x_0^n\log x_0}=\frac{\log x-\log x_0}{\log x_1-\log x_0}\;.$$

So the parameter $n$ is the slider you can slide from $0$ to $1$ to go from $\log x$ to $x$. You may have some precision issues to deal with as you get close to $n=0$, and you should make sure to handle the case $n=0$ separately using the actual $\log$ function.

Here's a plot for $y_0=0,y_1=1,x_0=1,x_1=10$ and $n=0,\frac14,\frac12,\frac34,1$.