matplotlib/matplotlib — pull request #3628 by switham (2014-10-10 03:39:30+00:00)
Title: Document auto-init behavior of colors.Normalize and cm.ScalarMappable.

modified: colors.py in class Normalize

norm = Normalize() # No parameters, the defaults.
aa = norm(a) # a is normalized according to a's min and max.
bb = norm(b) # b is normalized according to *a's min and max*.

That is, if vmin and vmax aren't set by the time the first __call__
happens, they are initialized as a side-effect, based on the data in
the first call.

This may well be the intended behavior, but the existing docstring
suggested autoscaling to whatever data comes through. Side-effects
should be documented so they sound like side-effects.

Documented this in the __init__ docstring (which is where the __call__
behavior was documented), and added a docstring to the __call__
method and also mentioned this side-effect behavior there.

modified: cm.py in class ScalarMappable

def __init__(norm=None, ...)
Added to the docstring that the default is really a new Normalize
initialized with no parameters, which auto-initializes scaling based
on the first input data.