Paul,

Thanks for the patch. Since numpoints <= 0 is an error, plain and 
simple, I committed a change (svn 4937) so that it will raise a more 
informative exception.  I don't think that trying to correct the error 
and raising a warning is a good strategy in this case.

Eric


[EMAIL PROTECTED] wrote:
> Included is a patch to change the behavior when legend() is called with 
> numpoints less than or equal to 0. Currently if one makes such a call, some 
> cryptic error messages are printed out and the plot is not generated.
> 
> The included patch produces a warning, and defaults to using numpoints = 4, 
> so the plot is actually made.
> 
> Paul Novak
> 
> ---
> --- legend.py 2008-02-01 19:14:24.000000000 -0600
> +++ legend.py 2008-02-01 19:13:55.000000000 -0600
> @@ -166,6 +166,12 @@
>  
>          self._loc = loc
>  
> +        if self.numpoints <= 0:
> +            warnings.warn('legend() called with numpoints = %d. '
> +                          'Default to numpoints = 4 because numpoints must 
> be greater than zero.' \
> +                          % (self.numpoints))
> +            self.numpoints = 4
> +
>          self.legendPatch = Rectangle(
>              xy=(0.0, 0.0), width=0.5, height=0.5,
>              facecolor='w', edgecolor='k',
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to