Logarithmic transformation into a [0, 1] percentage interval

logarithmstransformation

I've been trying to replicate a transformation of a [0, 10] inclusive interval into a [0, 1] interval. I'm motivated by the following examples (extracted from Smith et al.):

Example 1

Example 2

Where an input parameter ω goes through some kind of logarithmic transformation resulting in a percentage which can be used to linearly interpolate between two colors (at least this is my interpretation of the figure, if yours is different, please let me know).

Unfortunately, I don't have much information on the scale/parameters of such transformation, besides that the following [ω, y] pairs should hold true:

  1. [0, 0]
  2. [1, 0.5]
  3. [10, 1]

I have tried to use this information to intersect a curve that goes through these points by using:

$$y = a \times log(\omega + b) + c$$

But I don't think there is a solution to this equation that satisfies the three points I mentioned earlier? At least if there is I couldn't find it…

For now I have resorted to split the input interval in two, and applying different transformations depending on whether $\omega \le 1$ or $\omega > 1$, but I would really like to find a single function $f(\omega)$ that works for the whole [0, 10] interval.

Any help is much appreciated!

Best Answer

The scale used is unlikely to be a logarithm since they handle $0$ badly, and offsetting to avoid this rather defeats the point.

Looking at $0.01$ being about a tenth of the way to $10$ and some other points, I suspect it is more likely to be a cube root function. Since you say you want it to map $[0,10]$ to $[0,1]$ you could use $$f(x)=\sqrt[3]{\frac{x}{10}}$$ and you would get the following rounded values for the tick marks shown:

0       0
0.01    0.1
0.1     0.215
0.5     0.368
1       0.464
2       0.585
5       0.794
10      1

and overlaying this on your first chart (after subtracting from $1$ to get the scale to go downwards and stretching to fit) shows how good a match this gives

enter image description here

Related Question