Revision: 7097
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7097&view=rev
Author:   efiring
Date:     2009-05-08 19:04:34 +0000 (Fri, 08 May 2009)

Log Message:
-----------
clabel takes new kwarg, rightside_up (defaults to True)

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/contour.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2009-05-07 19:33:33 UTC (rev 7096)
+++ trunk/matplotlib/CHANGELOG  2009-05-08 19:04:34 UTC (rev 7097)
@@ -1,4 +1,9 @@
 ======================================================================
+2009-05-08 clabel takes new kwarg, rightside_up; if False, labels
+           will not be flipped to keep them rightside-up.  This
+           allows the use of clabel to make streamfunction arrows,
+           as requested by Evan Mason. - EF
+
 2009-05-07 'labelpad' can now be passed when setting x/y labels. This
            allows controlling the spacing between the label and its
            axis. - RMM

Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py  2009-05-07 19:33:33 UTC (rev 
7096)
+++ trunk/matplotlib/lib/matplotlib/contour.py  2009-05-08 19:04:34 UTC (rev 
7097)
@@ -91,6 +91,10 @@
             placement, delete or backspace act like the third mouse button,
             and any other key will select a label location).
 
+          *rightside_up*:
+            if *True* (default), label rotations will always be plus
+            or minus 90 degrees from level.
+
         .. plot:: mpl_examples/pylab_examples/contour_demo.py
         """
 
@@ -116,6 +120,8 @@
         # Detect if manual selection is desired and remove from argument list
         self.labelManual=kwargs.get('manual',False)
 
+        self.rightside_up = kwargs.get('rightside_up', True)
+
         if len(args) == 0:
             levels = self.levels
             indices = range(len(self.levels))
@@ -381,11 +387,12 @@
         else:
             rotation = np.arctan2(dd[1], dd[0]) * 180.0 / np.pi
 
-        # Fix angle so text is never upside-down
-        if rotation > 90:
-            rotation = rotation - 180.0
-        if rotation < -90:
-            rotation = 180.0 + rotation
+        if self.rightside_up:
+            # Fix angle so text is never upside-down
+            if rotation > 90:
+                rotation = rotation - 180.0
+            if rotation < -90:
+                rotation = 180.0 + rotation
 
         # Break contour if desired
         nlc = []


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

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to