Revision: 6752
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6752&view=rev
Author:   efiring
Date:     2009-01-06 19:56:03 +0000 (Tue, 06 Jan 2009)

Log Message:
-----------
Backport 6745, 6746 from trunk

Modified Paths:
--------------
    branches/v0_98_5_maint/CHANGELOG
    branches/v0_98_5_maint/lib/matplotlib/contour.py

Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG    2009-01-06 19:52:42 UTC (rev 6751)
+++ branches/v0_98_5_maint/CHANGELOG    2009-01-06 19:56:03 UTC (rev 6752)
@@ -1,3 +1,7 @@
+2009-01-06 Fix bug in setting of dashed negative contours. - EF
+
+2009-01-06 Be fault tolerant when len(linestyles)>NLev in contour. - MM
+
 2008-12-20 fix the dpi-dependent offset of Shadow. - JJL
 
 2008-12-20 fix the hatch bug in the pdf backend. minor update

Modified: branches/v0_98_5_maint/lib/matplotlib/contour.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/contour.py    2009-01-06 19:52:42 UTC 
(rev 6751)
+++ branches/v0_98_5_maint/lib/matplotlib/contour.py    2009-01-06 19:56:03 UTC 
(rev 6752)
@@ -535,7 +535,7 @@
         self.levels = kwargs.get('levels', None)
         self.filled = kwargs.get('filled', False)
         self.linewidths = kwargs.get('linewidths', None)
-        self.linestyles = kwargs.get('linestyles', 'solid')
+        self.linestyles = kwargs.get('linestyles', None)
 
         self.alpha = kwargs.get('alpha', 1.0)
         self.origin = kwargs.get('origin', None)
@@ -613,9 +613,6 @@
                                      linestyle = lstyle,
                                      alpha=self.alpha)
 
-                if level < 0.0 and self.monochrome:
-                    ls = mpl.rcParams['contour.negative_linestyle']
-                    col.set_linestyle(ls)
                 col.set_label('_nolegend_')
                 self.ax.add_collection(col, False)
                 self.collections.append(col)
@@ -857,11 +854,18 @@
         Nlev = len(self.levels)
         if linestyles is None:
             tlinestyles = ['solid'] * Nlev
+            if self.monochrome:
+                neg_ls = mpl.rcParams['contour.negative_linestyle']
+                for i, lev in enumerate(self.levels):
+                    if lev < 0.0:
+                        tlinestyles[i] = neg_ls
         else:
             if cbook.is_string_like(linestyles):
                 tlinestyles = [linestyles] * Nlev
-            elif cbook.iterable(linestyles) and len(linestyles) <= Nlev:
+            elif cbook.iterable(linestyles) and len(linestyles) < Nlev:
                 tlinestyles = list(linestyles) * 
int(np.ceil(Nlev/len(linestyles)))
+            elif cbook.iterable(linestyles): # len(linestyles) >= Nlev
+                tlinestyles = list(linestyles)[:Nlev]
         return tlinestyles
 
     def get_alpha(self):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to