Hi,

in this example:

========================================
import numpy as np
import matplotlib.pyplot as plt

arr = np.random.random((10, 10))

plt.contourf(arr, 10)
plt.contourf(arr, 10, cmap='coolwarm', levels=np.arange(0, 1, .2), alpha=.5)
plt.colorbar()
plt.show()
========================================

colorbar is representing last contour. 

I want to make colorbar that will match actual plot, which is combination of 
two contours obviously. I tried also something like:

========================================
import numpy as np
import matplotlib.pyplot as plt

arr = np.random.random((10, 10))

fig = plt.figure()
ax = fig.add_subplot(111)

cax = ax.contourf(arr, 10)
cb = fig.colorbar(cax)
cax = ax.contourf(arr, 10, cmap='coolwarm', levels=np.arange(0, 1, .2), 
alpha=.5)
cb.update_bruteforce(cax)    # tried also: cb.update_normal(cax)

plt.show()
========================================

but it didn't get me there. Is there some easy way to do this?

Thanks


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to