matplotlib/matplotlib — pull request #3753 by iosonofabio (2014-11-03 15:12:36+00:00)
Title: Logit scale

As discussed earlier today on the mailing list, here the proposal of PR for a new scale, the LogitScale. This is essentially a nonlinear scale that is log both towards 0+ and log towards 1-. The exact transformation is:

x -> log10 (x / 1 - x)

(the 10 base of the log is just the most common case for plotting, but I could extend to natural or base 2 logs if there is interest). The inverse transform is the logistic function:

x -> 1 / (1 + 10^-x)

(again, 10 is just one possible base).

The LogitScale is useful when one has frequencies in a population (i.e. floats between 0 and 1) and both rare events and very common ones are interesting. For instance, say you ask about the fraction of people with blue eyes in various world populations, you want to spot even tiny deviations from zero or one.

Pierre Haessig had one implementation with example plots here:

http://nbviewer.ipython.org/gist/pierre-haessig/7e3e6a818edeb6819708

I had developed another, virtually identically one in the last few days, but this PR takes essentially his code and slightly modifies it for style and a few design points.

**Note**: there are a few FIXME in the code in case of doubts, please enlighten me on the best practice in those cases. Tests and docs also still missing.