So I been using the log scale provided by matplotlib.colors.LogNorm, but have been seing bizarre behaviour. Basically, high values are not displayed properly. I give simple examples below with just two possible values in the matrix, but all the same issues arise with more varied values.
First notice that the high value (100000) is displayed as being of value=1:
from pylab import *
from matplotlib.colors import LogNorm
matrix = ones((30,30))
matrix = matrix*440
matrix[29,29] = 100000
matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000))
colorbar()
show()
The cutoff value for incorrect display (for the scale I am using) seems to be at 32000:
from pylab import *
from matplotlib.colors import LogNorm
matrix = ones((30,30))
matrix = matrix*440
matrix[29,29] = 32000
matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000))
colorbar()
show()
However, if the value is really high, the color displayed changes again, although still not to the correct color (please try with values 918000, 920000, and 999000 to see see it progress):
from pylab import *
from matplotlib.colors import LogNorm
matrix = ones((30,30))
matrix = matrix*440
matrix[29,29] = 918000
matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000))
colorbar()
show()
And if one specifies no limits to LogNorm, the colorbar displayed is incomplete and the colour displayed is wrong in a different way then when specifying the limits (try value = 999000 as well).
from pylab import *
from matplotlib.colors import LogNorm
matrix = ones((30,30))
matrix = matrix*440
matrix[29,29] = 918000
matshow(matrix, norm=LogNorm())
colorbar()
show()
Either I am completely missing something or there is a major bug.
I am using mpl checked out from svn on 26 March.
Thanks,
Suresh