On Wednesday 28 April 2010 09:21:54 Eric Firing wrote:
> Matthias Michler wrote:
> [...]
>
> > First of all I think my previously described error in the over-color is
> > due to a bug in the set up of the colors.ListedColormap during the
> > initialisation of ContourSet if 'self.colors' is not None.
> > For the number of entries in the map 'N' the number of layers is
> > passed "N=len(self.layers)", which is not useful if self.extend is
> > 'both'. Let's say I want 3 regions and provide 3 colors. If extend is
> > 'both' the number of layers is the #{colored regions between min and max}
> > + 2 = 5. For N=5 in the initialisation of the ListedColormap the list of
> > colors is extended to have length 'N=5' (by repetition). Therefore an
> > additional layer (more precisely 2) occurs in the colormap and although
> > the over_color is set to something different the (repeted) first element
> > of 'colors' is used to color values above the highest level.
> >
> > I propose the following case differentiation:
> > if self.extend == "both":
> >     N = len(self.layers) - 2
> > elif self.extend in ('max', 'min'):
> >     N = len(self.layers) - 1
> > else:
> >     N = len(self.layers)
> >
> > Maybe N = len(self.levels) - 1 is always a good solution.
> >
> > Is this a bug and does my proposal resolve it without destroying
> > something else?
>
> Matthias,
>
> I think I have fixed the problem.  I also changed the second plot in
> contourf_demo to include the extended colorbar.  Attached is a
> modification of one of your illustrative scripts with some unnecessary
> kwargs stripped out.  In particular, when contourf makes a
> ListedColormap, you don't need or want to specify the norm--it uses the
> appropriate one, which is NoNorm.  Also, you probably don't need to
> specify the view limits when making the subplot (contourf will autoscale
> with tight boundaries), and you don't need to pass the extend kwarg to
> colormap--it gets it from the ContourSet object.
>
> Eric

Hi Eric,

thanks a lot for fixing this bug and including an extended colorbar in the 
examples.

Kind regards,
Matthias

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to