import sys, numpy, matplotlib
print('Python', sys.version)
print('numpy', numpy.__version__)
print('matplotlib', matplotlib.__version__)
Python 3.4.1 (default, May 19 2014, 17:23:49) [GCC 4.9.0 20140507 (prerelease)] numpy 1.8.1 matplotlib 1.3.1
from numpy import array
from matplotlib.colors import SymLogNorm
data = array([-1, -0.2, 0, 0.01, 0.2, 4])
norm1 = SymLogNorm(0.1, vmin=-1, vmax=40)
norm2 = SymLogNorm(0.1, vmax=40)
print(norm1(data))
print(norm2(data))
[-inf -inf nan inf inf inf] [ 0. 0.14046408 0.33902607 0.35283281 0.53758806 0.79904133]
/usr/lib/python3.4/site-packages/matplotlib/colors.py:1077: RuntimeWarning: divide by zero encountered in true_divide resdat /= (self._upper - self._lower) /usr/lib/python3.4/site-packages/matplotlib/colors.py:1077: RuntimeWarning: invalid value encountered in true_divide resdat /= (self._upper - self._lower)
print(norm1.vmin, norm1.vmax, norm1._lower, norm1._upper)
print(norm2.vmin, norm2.vmax, norm2._lower, norm2._upper)
-1 40 0 0 -1.0 40 -0.388456179986 0.757344125398