default colorbar for matplotlib
Question: I'd like to change the global default colorbar for all graphics commands in
Python matplotlib. This is similar to [this question about changing the
default colorbar in MATLAB](http://stackoverflow.com/questions/6034903/how-do-
you-set-a-custom-default-colormap-in-matlab). Here [there is already a
pythonic solution](http://stackoverflow.com/questions/10437689/matplotlib-
globally-set-number-of-ticks-x-axis-y-axis-colorbar), but that solution
requires making a plot in order for the change to take effect. Is there a way
to set the default before the first plot is made?

Putting the following in `~/.pythonrc` seems like it ought to work, but it
does not:

    
    
    import matplotlib.pylab as plt
    plt.rcParams['image.cmap'] = plt.cm.bwr
    

Furthermore, I'd like to set the default to something from the
`colorbrewer2mpl` package, not just a pre-existing matplotlib option.


Answer: One solution that does work is to [customize the matplotlibrc
file](http://matplotlib.org/users/customizing.html)

Find it:

    
    
    import matplotlib
    matplotlib.matplotlib_fname()
    

Edit it:

    
    
    image.cmap: bwr
    

However, this method only lets me select default named colorbars, not, for
example, [ColorBrewer](http://colorbrewer2.org/) colorbars available via the
`colorbrewer2mpl` package.

