Thank you so much Ben,
Now the plot comes correctly after trying your suggestion.
I set cmap.set_under() and cmap.set_over() before calling contourf() and now the plot comes correctly irrespective of cal to the colorbar() function.
On Thu, Oct 14, 2010 at 9:50 AM, Bala subramanian <firstname.lastname@example.org> wrote:
you are right, contouf() omits the red and blue values without colorbar.
1) If i call set_under() and set_over() before calling contourf(), i get an error. This is obvious because i am setting a property of the countourf() object before creating it. I get NameError: name 'CNF' is not defined
2) If i set set_under() and set_over(), after the colorbar(), the colorbar() is shown correctly but contourf() again dose not create the red and blue values. I have also attached my test matrix file with this mail.
Bala, in the code example you gave, you have a cmap object that you pass into contourf. The cmap object that you are accessing after contourf is exactly the same object, so why not just call "cmap.set_over()" before the contourf()?