matplotlib: How can you specify colour levels in a 2D historgram
I would like to plot a 2D histogram that includes both positive and negative numbers. I have the following code which uses pcolormesh but I am unable to specify the color levels to force the white color to corresponds to zero (i.e., I want my colorbar to be symmetric around zero). I've also tried imshow. I know you can specify colour levels in plt.contour and plt.contourf but I can't find a way to plot the 2D histogram using blocks. Any advice would be greatly appreciated. import numpy as np import matplotlib.pyplot as plt from matplotlib import cm as CM fig = plt.figure() # create an example