I am trying to build a matrix with positive and negative numbers. Numbers will range from -1 to 1, but not in the full range. For example, numbers can range from -0.2 to +0.8 (see Code below). I want to use bwr-colormap (blue β white - red), so zero always has a color coding in white. -1 should be color coded in the darkest blue, and +1 should be color coded in dark red. Here is an example where both scenes are distinguishable only by their color panel.
import numpy from matplotlib import pyplot as plt
The image created by this code can be seen here: 
As stated above, I am looking for a way to always encode colors with the same colors, where -1: dark blue, 0: white, +1: dark red. Is this one liner and am I missing something, or do I need to write something for this?
EDIT: After digging a little longer, I found a satisfactory answer myself, not touching the color map, but using additional inputs for pcolor (see below). However, I will not delete the question, since I could not find the answer to SO until I posted this question and clicked on the related questions / answers. On the other hand, I would not mind if it was deleted, as the answers to this question can be found elsewhere if you are looking for the right keywords.
source share