SF.net SVN: matplotlib:[6432] trunk/matplotlib

2008-11-23 Thread jdh2358
Revision: 6432
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6432&view=rev
Author:   jdh2358
Date: 2008-11-23 19:04:35 + (Sun, 23 Nov 2008)

Log Message:
---
generalized fill between poly collection

Modified Paths:
--
trunk/matplotlib/examples/api/filled_masked_regions.py
trunk/matplotlib/lib/matplotlib/collections.py

Modified: trunk/matplotlib/examples/api/filled_masked_regions.py
===
--- trunk/matplotlib/examples/api/filled_masked_regions.py  2008-11-21 
18:20:00 UTC (rev 6431)
+++ trunk/matplotlib/examples/api/filled_masked_regions.py  2008-11-23 
19:04:35 UTC (rev 6432)
@@ -8,31 +8,36 @@
 
 
 t = np.arange(0.0, 2, 0.01)
-s = np.sin(2*np.pi*t)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
 
 fig = plt.figure()
 ax = fig.add_subplot(111)
-ax.set_title('using fill_between_masked')
-ax.plot(t, s, '-')
+ax.set_title('using fill_between_where')
+ax.plot(t, s1, t, s2)
 ax.axhline(0, color='black', lw=2)
 
-collection = collections.PolyCollection.fill_between_masked(t, s, s>=0, 
yboundary=0, color='green', alpha=0.5)
+collection = collections.PolyCollection.fill_between_where(
+  t, s1, s2, s1>=s2, color='green', alpha=0.5)
 ax.add_collection(collection)
 
-collection = collections.PolyCollection.fill_between_masked(t, s, s<=0, 
yboundary=0, color='red', alpha=0.5)
+collection = collections.PolyCollection.fill_between_where(
+  t, s1, s2, s1<=s2, color='red', alpha=0.5)
 ax.add_collection(collection)
 
 
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.set_title('using span_masked')
-ax.plot(t, s, '-')
+ax.plot(t, s1, '-')
 ax.axhline(0, color='black', lw=2)
 
-collection = collections.BrokenBarHCollection.span_masked(t, s>0, ymin=0, 
ymax=1, facecolor='green', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_masked(
+  t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
 ax.add_collection(collection)
 
-collection = collections.BrokenBarHCollection.span_masked(t, s<0, ymin=-1, 
ymax=0, facecolor='red', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_masked(
+  t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
 ax.add_collection(collection)
 
 

Modified: trunk/matplotlib/lib/matplotlib/collections.py
===
--- trunk/matplotlib/lib/matplotlib/collections.py  2008-11-21 18:20:00 UTC 
(rev 6431)
+++ trunk/matplotlib/lib/matplotlib/collections.py  2008-11-23 19:04:35 UTC 
(rev 6432)
@@ -674,7 +674,7 @@
 
 
 @staticmethod
-def fill_between_masked(x, y, mask, yboundary=0, **kwargs):
+def fill_between_where(x, y1, y2, mask, **kwargs):
 """
 Create a :class:`PolyCollection` filling the regions between *y*
 and *yboundary7* where ``mask==True``
@@ -683,35 +683,50 @@
 *x*
   an N length np array of the x data
 
-*y*
-  an N length np array of the y data
+*y1*
+  an N length scalar or np array of the x data
 
+*y2*
+  an N length scalar or np array of the x data
+
 *mask*
   an N length numpy boolean array
 
-*yboundary*
-  a scalar to fill between *y* and the boundary
-
 *kwargs*
   keyword args passed on to the :class:`PolyCollection`
 
 """
+   if not cbook.iterable(y1):
+   y1 = np.ones_like(x)*y1
+
+   if not cbook.iterable(y2):
+   y2 = np.ones_like(x)*y2
+
+assert( (len(x)==len(y1)) and (len(x)==len(y2)) )
+
 polys = []
 for ind0, ind1 in mlab.contiguous_regions(mask):
 theseverts = []
 xslice = x[ind0:ind1]
-yslice = y[ind0:ind1]
+y1slice = y1[ind0:ind1]
+y2slice = y2[ind0:ind1]
+
 if not len(xslice):
 continue
 
 N = len(xslice)
 X = np.zeros((2*N+2, 2), np.float)
-X[0] = xslice[0], yboundary
-X[N+1] = xslice[-1], yboundary
+
+# the purpose of the next two lines is for when y2 is a
+# scalar like 0 and we want the fill to go all the way
+# down to 0 even if none of the y1 sample points do
+X[0] = xslice[0], y2slice[0]
+X[N+1] = xslice[-1], y2slice[-1]
+
 X[1:N+1,0] = xslice
-X[1:N+1,1] = yslice
+X[1:N+1,1] = y1slice
 X[N+2:,0] = xslice[::-1]
-X[N+2:,1] = yboundary
+X[N+2:,1] = y2slice[::-1]
 
 polys.append(X)
 


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand p

SF.net SVN: matplotlib:[6433] trunk/matplotlib

2008-11-23 Thread jdh2358
Revision: 6433
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6433&view=rev
Author:   jdh2358
Date: 2008-11-23 19:05:58 + (Sun, 23 Nov 2008)

Log Message:
---
renamed fill where examples

Modified Paths:
--
trunk/matplotlib/CHANGELOG

Added Paths:
---
trunk/matplotlib/examples/api/fill_where_demo.py

Removed Paths:
-
trunk/matplotlib/examples/api/filled_masked_regions.py

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2008-11-23 19:04:35 UTC (rev 6432)
+++ trunk/matplotlib/CHANGELOG  2008-11-23 19:05:58 UTC (rev 6433)
@@ -1,10 +1,7 @@
 2008-11-20 Added some static helper methods
BrokenHBarCollection.span_masked and
-   PolyCollection.fill_between_masked for visualizing
-   non-masked regions.  In the longer term, the better
-   solution will be to fix the relevant classes and functions
-   to handle masked data, so this may be a temporary solution
-   - JDH
+   PolyCollection.fill_between_where for visualizing logical
+   regions.  See examples/api/fill_where_demo.py - JDH
 
 2008-11-12 Add x_isdata and y_isdata attributes to Artist instances,
and use them to determine whether either or both

Copied: trunk/matplotlib/examples/api/fill_where_demo.py (from rev 6432, 
trunk/matplotlib/examples/api/filled_masked_regions.py)
===
--- trunk/matplotlib/examples/api/fill_where_demo.py
(rev 0)
+++ trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:05:58 UTC 
(rev 6433)
@@ -0,0 +1,50 @@
+"""
+Illustrate some helper functions for shading regions where a logical
+mask is True
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.collections as collections
+
+
+t = np.arange(0.0, 2, 0.01)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using fill_between_where')
+ax.plot(t, s1, t, s2)
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.PolyCollection.fill_between_where(
+  t, s1, s2, s1>=s2, color='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.PolyCollection.fill_between_where(
+  t, s1, s2, s1<=s2, color='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using span_masked')
+ax.plot(t, s1, '-')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.BrokenBarHCollection.span_masked(
+  t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.BrokenBarHCollection.span_masked(
+  t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+
+plt.show()
+
+
+
+
+

Deleted: trunk/matplotlib/examples/api/filled_masked_regions.py
===
--- trunk/matplotlib/examples/api/filled_masked_regions.py  2008-11-23 
19:04:35 UTC (rev 6432)
+++ trunk/matplotlib/examples/api/filled_masked_regions.py  2008-11-23 
19:05:58 UTC (rev 6433)
@@ -1,50 +0,0 @@
-"""
-Illustrate some helper functions for shading regions where a logical
-mask is True
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.collections as collections
-
-
-t = np.arange(0.0, 2, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = 1.2*np.sin(4*np.pi*t)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using fill_between_where')
-ax.plot(t, s1, t, s2)
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, s1>=s2, color='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, s1<=s2, color='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using span_masked')
-ax.plot(t, s1, '-')
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.BrokenBarHCollection.span_masked(
-  t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.BrokenBarHCollection.span_masked(
-  t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-
-plt.show()
-
-
-
-
-


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.p

SF.net SVN: matplotlib:[6434] trunk/matplotlib

2008-11-23 Thread jdh2358
Revision: 6434
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6434&view=rev
Author:   jdh2358
Date: 2008-11-23 19:15:01 + (Sun, 23 Nov 2008)

Log Message:
---
updated api for fill_between_where and span_where

Modified Paths:
--
trunk/matplotlib/examples/api/fill_where_demo.py
trunk/matplotlib/lib/matplotlib/collections.py

Modified: trunk/matplotlib/examples/api/fill_where_demo.py
===
--- trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:05:58 UTC 
(rev 6433)
+++ trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:15:01 UTC 
(rev 6434)
@@ -1,6 +1,9 @@
 """
 Illustrate some helper functions for shading regions where a logical
 mask is True
+
+See :meth:`matplotlib.collections.PolyCollection.fill_between_where`
+and :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
 """
 import numpy as np
 import matplotlib.pyplot as plt
@@ -18,26 +21,26 @@
 ax.axhline(0, color='black', lw=2)
 
 collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, s1>=s2, color='green', alpha=0.5)
+  t, s1, s2, where=s1>=s2, color='green', alpha=0.5)
 ax.add_collection(collection)
 
 collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, s1<=s2, color='red', alpha=0.5)
+  t, s1, s2, where=s1<=s2, color='red', alpha=0.5)
 ax.add_collection(collection)
 
 
 fig = plt.figure()
 ax = fig.add_subplot(111)
-ax.set_title('using span_masked')
+ax.set_title('using span_where')
 ax.plot(t, s1, '-')
 ax.axhline(0, color='black', lw=2)
 
-collection = collections.BrokenBarHCollection.span_masked(
-  t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_where(
+  t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5)
 ax.add_collection(collection)
 
-collection = collections.BrokenBarHCollection.span_masked(
-  t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_where(
+  t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5)
 ax.add_collection(collection)
 
 

Modified: trunk/matplotlib/lib/matplotlib/collections.py
===
--- trunk/matplotlib/lib/matplotlib/collections.py  2008-11-23 19:05:58 UTC 
(rev 6433)
+++ trunk/matplotlib/lib/matplotlib/collections.py  2008-11-23 19:15:01 UTC 
(rev 6434)
@@ -674,10 +674,10 @@
 
 
 @staticmethod
-def fill_between_where(x, y1, y2, mask, **kwargs):
+def fill_between_where(x, y1, y2, where, **kwargs):
 """
 Create a :class:`PolyCollection` filling the regions between *y*
-and *yboundary7* where ``mask==True``
+and *yboundary7* where ``where==True``
 
 
 *x*
@@ -689,7 +689,7 @@
 *y2*
   an N length scalar or np array of the x data
 
-*mask*
+*where*
   an N length numpy boolean array
 
 *kwargs*
@@ -705,7 +705,7 @@
 assert( (len(x)==len(y1)) and (len(x)==len(y2)) )
 
 polys = []
-for ind0, ind1 in mlab.contiguous_regions(mask):
+for ind0, ind1 in mlab.contiguous_regions(where):
 theseverts = []
 xslice = x[ind0:ind1]
 y1slice = y1[ind0:ind1]
@@ -756,17 +756,17 @@
 
 
 @staticmethod
-def span_masked(x, mask, ymin, ymax, **kwargs):
+def span_where(x, ymin, ymax, where, **kwargs):
 """
 Create a BrokenBarHCollection to plot horizontal bars from
-over the regions in *x* where *mask* is True.  The bars range
+over the regions in *x* where *where* is True.  The bars range
 on the y-axis from *ymin* to *ymax*
 
 A :class:`BrokenBarHCollection` is returned.
 **kwargs are passed on to the collection
 """
 xranges = []
-for ind0, ind1 in mlab.contiguous_regions(mask):
+for ind0, ind1 in mlab.contiguous_regions(where):
 xslice = x[ind0:ind1]
 if not len(xslice):
 continue


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6435] trunk/matplotlib/examples/pylab_examples/ fill_between_posneg.py

2008-11-23 Thread jdh2358
Revision: 6435
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6435&view=rev
Author:   jdh2358
Date: 2008-11-23 19:16:40 + (Sun, 23 Nov 2008)

Log Message:
---
remove deprecated fill example

Removed Paths:
-
trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py

Deleted: trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py
===
--- trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 
2008-11-23 19:15:01 UTC (rev 6434)
+++ trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 
2008-11-23 19:16:40 UTC (rev 6435)
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-"""
-From: James Boyle <[EMAIL PROTECTED]>
-Subject: possible candidate for examples directory using fill
-To: John Hunter <[EMAIL PROTECTED]>
-Date: Tue, 8 Mar 2005 15:44:11 -0800
-
-I often compare the output from two sensors and I am interested in the
-sign of the differences.
-
-I wrote the enclosed code for find the polygons of the positive and
-negative regions of the difference of two curves. It is written for
-simple-minded straightforwardness rather than speed or elegance.
-It is easy to fill in the two sets of polygons with contrasting colors.
-For efficiency one could use collections but my curves are such that
-fill is quick enough.
-
-The code uses a simple linear technique to find the crossover point,
-this too could be made more sophisticated if one desired.
-
-I have found this code to be very handy for the comparisons I perform
--
-maybe someone else would find it useful.
-
---Jim
-"""
-
-#!/usr/bin/env python
-
-from pylab import *
-
-def findZero(i,x,y1,y2):
- im1 = i-1
- m1 = (y1[i] - y1[im1])/(x[i] - x[im1])
- m2 = (y2[i] - y2[im1])/(x[i] - x[im1])
- b1 = y1[im1] - m1*x[im1]
- b2 = y2[im1] - m2*x[im1]
- xZero = (b1 - b2)/(m2 - m1)
- yZero = m1*xZero + b1
- return (xZero, yZero)
-
-def posNegFill(x,y1,y2):
-  diff = y2 - y1
-  pos = []
-  neg = []
-  xx1 = [x[0]]
-  xx2 = [x[0]]
-  yy1 = [y1[0]]
-  yy2 = [y2[0]]
-  oldSign = (diff[0] < 0 )
-  npts = x.shape[0]
-  for i in range(1,npts):
-  newSign = (diff[i] < 0)
-  if newSign != oldSign:
-  xz,yz = findZero(i,x,y1,y2)
-  xx1.append(xz)
-  yy1.append(yz)
-  xx2.reverse()
-  xx1.extend(xx2)
-  yy2.reverse()
-  yy1.extend(yy2)
-  if oldSign:
-  neg.append( (xx1,yy1) )
-  else:
-  pos.append( (xx1,yy1) )
-  xx1 = [xz,x[i]]
-  xx2 = [xz,x[i]]
-  yy1 = [yz,y1[i]]
-  yy2 = [yz,y2[i]]
-  oldSign = newSign
-  else:
-  xx1.append( x[i])
-  xx2.append( x[i])
-  yy1.append(y1[i])
-  yy2.append(y2[i])
-  if i == npts-1:
-  xx2.reverse()
-  xx1.extend(xx2)
-  yy2.reverse()
-  yy1.extend(yy2)
-  if oldSign :
-  neg.append( (xx1,yy1) )
-  else:
-  pos.append( (xx1,yy1) )
-  return pos,neg
-
-x1 = arange(0, 2, 0.01)
-y1 = sin(2*pi*x1)
-y2 = sin(4*pi*x1)
-
-# find positive and negative polygons of difference
-pos,neg =  posNegFill(x1,y1,y2)
-# positive y2 > y1 is blue
-for x,y  in pos:
- p = fill(x,y,'b')
-
-# negative Y2 < y1 is red
-for x,y in neg:
- p = fill(x,y,'r')
-
-show()


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6436] trunk/matplotlib/lib/matplotlib/text.py

2008-11-23 Thread jdh2358
Revision: 6436
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6436&view=rev
Author:   jdh2358
Date: 2008-11-23 19:18:24 + (Sun, 23 Nov 2008)

Log Message:
---
fixed text docstring

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/text.py

Modified: trunk/matplotlib/lib/matplotlib/text.py
===
--- trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:16:40 UTC (rev 
6435)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:18:24 UTC (rev 
6436)
@@ -375,7 +375,7 @@
 
 if not isinstance(self.arrow_patch, FancyArrowPatch):
 return
-
+
 if self._bbox_patch:
 
 trans = self.get_transform()
@@ -1295,8 +1295,8 @@
 instance is created with the given dictionary and is
 drawn. Otherwise, a YAArow patch instance is created and
 drawn. Valid keys for YAArow are
-
 
+
 =   ===
 Key Description
 =   ===
@@ -1314,10 +1314,10 @@
 
 
 Valid keys for FancyArrowPatch are
-
 
+
 ===  ==
-Key Description
+Key  Description
 ===  ==
 arrowstyle
 connectionstyle
@@ -1383,7 +1383,7 @@
 self.arrowprops = arrowprops
 
 self.arrow = None
-
+
 if arrowprops and arrowprops.has_key("arrowstyle"):
 
 self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5))
@@ -1392,7 +1392,7 @@
 else:
 self.arrow_patch = None
 
-
+
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 def contains(self,event):
@@ -1402,7 +1402,7 @@
 t = t or a
 
 # self.arrow_patch is currently not checked as this can be a line - JJ
-
+
 return t,tinfo
 
 
@@ -1551,7 +1551,7 @@
 # Then it will be shrinked by shirnkA and shrinkB
 # (in points). If patch A is not set, self.bbox_patch
 # is used.
-
+
 self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1))
 mutation_scale = d.pop("mutation_scale", self.get_size())
 self.arrow_patch.set_mutation_scale(mutation_scale)
@@ -1562,7 +1562,7 @@
 else:
 patchA = d.pop("patchA", self._bbox)
 self.arrow_patch.set_patchA(patchA)
-
+
 else:
 
 # pick the x,y corner of the text bbox closest to point


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6437] trunk/matplotlib

2008-11-23 Thread jdh2358
Revision: 6437
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6437&view=rev
Author:   jdh2358
Date: 2008-11-23 19:56:37 + (Sun, 23 Nov 2008)

Log Message:
---
moved fill_between to axes/pyplot method

Modified Paths:
--
trunk/matplotlib/boilerplate.py
trunk/matplotlib/doc/_templates/index.html
trunk/matplotlib/examples/api/fill_where_demo.py
trunk/matplotlib/examples/pylab_examples/fill_between.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/pyplot.py

Added Paths:
---
trunk/matplotlib/examples/api/span_regions.py

Modified: trunk/matplotlib/boilerplate.py
===
--- trunk/matplotlib/boilerplate.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/boilerplate.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -64,6 +64,7 @@
 'csd',
 'errorbar',
 'fill',
+'fill_between',
 'hexbin',
 'hist',
 'hlines',

Modified: trunk/matplotlib/doc/_templates/index.html
===
--- trunk/matplotlib/doc/_templates/index.html  2008-11-23 19:18:24 UTC (rev 
6436)
+++ trunk/matplotlib/doc/_templates/index.html  2008-11-23 19:56:37 UTC (rev 
6437)
@@ -409,8 +409,21 @@
   
 
 
+
 
   
+fill_between
+
+  
+
+  
+make filled polygons between two curves
+  
+
+
+
+
+  
 findobj
 
   

Modified: trunk/matplotlib/examples/api/fill_where_demo.py
===
--- trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:18:24 UTC 
(rev 6436)
+++ trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:56:37 UTC 
(rev 6437)
@@ -17,7 +17,7 @@
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.set_title('using fill_between_where')
-ax.plot(t, s1, t, s2)
+ax.plot(t, s1, t, s2, color='black')
 ax.axhline(0, color='black', lw=2)
 
 collection = collections.PolyCollection.fill_between_where(
@@ -32,7 +32,7 @@
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.set_title('using span_where')
-ax.plot(t, s1, '-')
+ax.plot(t, s1, , color='black')
 ax.axhline(0, color='black', lw=2)
 
 collection = collections.BrokenBarHCollection.span_where(

Added: trunk/matplotlib/examples/api/span_regions.py
===
--- trunk/matplotlib/examples/api/span_regions.py   
(rev 0)
+++ trunk/matplotlib/examples/api/span_regions.py   2008-11-23 19:56:37 UTC 
(rev 6437)
@@ -0,0 +1,38 @@
+"""
+Illustrate some helper functions for shading regions where a logical
+mask is True
+
+See :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.collections as collections
+
+
+t = np.arange(0.0, 2, 0.01)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using span_where')
+ax.plot(t, s1, color='black')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.BrokenBarHCollection.span_where(
+  t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.BrokenBarHCollection.span_where(
+  t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+
+plt.show()
+
+
+
+
+

Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===
--- trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-23 
19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-23 
19:56:37 UTC (rev 6437)
@@ -3,27 +3,31 @@
 from pylab import figure, show
 import numpy as np
 
-x = np.arange(0, 2, 0.01)
+x = np.arange(0.0, 2, 0.01)
 y1 = np.sin(2*np.pi*x)
-y2 = np.sin(4*np.pi*x) + 2
+y2 = 1.2*np.sin(4*np.pi*x)
 
 fig = figure()
-ax = fig.add_subplot(311)
-ax2 = fig.add_subplot(312)
-ax3 = fig.add_subplot(313)
+ax1 = fig.add_subplot(311)
+ax2 = fig.add_subplot(312, sharex=ax1)
+ax3 = fig.add_subplot(313, sharex=ax1)
 
+ax1.fill_between(x, 0, y1)
+ax1.set_ylabel('between y1 and 0')
 
-xs, ys = mlab.poly_between(x, 0, y1)
-ax.fill(xs, ys)
-ax.set_ylabel('between y1 and 0')
-
-xs, ys = mlab.poly_between(x, y1, 1)
-ax2.fill(xs, ys)
+ax2.fill_between(x, y1, 1)
 ax2.set_ylabel('between y1 and 1')
 
-xs, ys = mlab.poly_between(x, y1, y2)
-ax3.fill(xs, ys)
+ax3.fill_between(x, y1, y2)
 ax3.set_ylabel('between y1 and y2')
 ax3.set_xlabel('x')
+
+fig = figure()
+ax = fig.add_subplot(111)
+ax1.plot(x, y1, x, y2, color='black')
+ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
+ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
+ax.set_title('fill between where')
+
 show()
 

Modifie

SF.net SVN: matplotlib:[6438] trunk/matplotlib/examples/api/fill_where_demo .py

2008-11-23 Thread jdh2358
Revision: 6438
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6438&view=rev
Author:   jdh2358
Date: 2008-11-23 19:57:18 + (Sun, 23 Nov 2008)

Log Message:
---
removed deprecated example

Removed Paths:
-
trunk/matplotlib/examples/api/fill_where_demo.py

Deleted: trunk/matplotlib/examples/api/fill_where_demo.py
===
--- trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:56:37 UTC 
(rev 6437)
+++ trunk/matplotlib/examples/api/fill_where_demo.py2008-11-23 19:57:18 UTC 
(rev 6438)
@@ -1,53 +0,0 @@
-"""
-Illustrate some helper functions for shading regions where a logical
-mask is True
-
-See :meth:`matplotlib.collections.PolyCollection.fill_between_where`
-and :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.collections as collections
-
-
-t = np.arange(0.0, 2, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = 1.2*np.sin(4*np.pi*t)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using fill_between_where')
-ax.plot(t, s1, t, s2, color='black')
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, where=s1>=s2, color='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.PolyCollection.fill_between_where(
-  t, s1, s2, where=s1<=s2, color='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using span_where')
-ax.plot(t, s1, , color='black')
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.BrokenBarHCollection.span_where(
-  t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.BrokenBarHCollection.span_where(
-  t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-
-plt.show()
-
-
-
-
-


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6439] trunk/matplotlib/examples/pylab_examples/ fill_between.py

2008-11-23 Thread jdh2358
Revision: 6439
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6439&view=rev
Author:   jdh2358
Date: 2008-11-23 20:09:08 + (Sun, 23 Nov 2008)

Log Message:
---
removed deprecated example

Modified Paths:
--
trunk/matplotlib/examples/pylab_examples/fill_between.py

Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===
--- trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-23 
19:57:18 UTC (rev 6438)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-23 
20:09:08 UTC (rev 6439)
@@ -22,6 +22,10 @@
 ax3.set_ylabel('between y1 and y2')
 ax3.set_xlabel('x')
 
+# now fill between y1 and y2 where a logical condition is met.  Note
+# this is different than calling
+#   fill_between(x[where], y1[where],y2[where]
+# because of edge effects over multiple contiguous regions.
 fig = figure()
 ax = fig.add_subplot(111)
 ax1.plot(x, y1, x, y2, color='black')


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6440] trunk/matplotlib/lib/matplotlib/axes.py

2008-11-23 Thread jdh2358
Revision: 6440
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6440&view=rev
Author:   jdh2358
Date: 2008-11-23 20:15:36 + (Sun, 23 Nov 2008)

Log Message:
---
fixed datalim update for fill_between

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/axes.py

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 20:09:08 UTC (rev 
6439)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 20:15:36 UTC (rev 
6440)
@@ -5559,8 +5559,14 @@
 
 collection = mcoll.PolyCollection(polys, **kwargs)
 
-self.update_datalim_numerix(x[where], y1[where])
-self.update_datalim_numerix(x[where], y2[where])
+# now update the datalim and autoscale
+XY1 = np.array([x[where], y1[where]]).T
+XY2 = np.array([x[where], y2[where]]).T
+self.dataLim.update_from_data_xy(XY1, self.ignore_existing_data_limits,
+ updatex=True, updatey=True)
+
+self.dataLim.update_from_data_xy(XY2, self.ignore_existing_data_limits,
+ updatex=False, updatey=True)
 self.add_collection(collection)
 self.autoscale_view()
 return collection


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6441] trunk/matplotlib/examples/pylab_examples/ fill_between.py

2008-11-23 Thread jdh2358
Revision: 6441
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6441&view=rev
Author:   jdh2358
Date: 2008-11-24 03:53:14 + (Mon, 24 Nov 2008)

Log Message:
---
fixed a small bug in fill_between

Modified Paths:
--
trunk/matplotlib/examples/pylab_examples/fill_between.py

Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===
--- trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-23 
20:15:36 UTC (rev 6440)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py2008-11-24 
03:53:14 UTC (rev 6441)
@@ -28,7 +28,7 @@
 # because of edge effects over multiple contiguous regions.
 fig = figure()
 ax = fig.add_subplot(111)
-ax1.plot(x, y1, x, y2, color='black')
+ax.plot(x, y1, x, y2, color='black')
 ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
 ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
 ax.set_title('fill between where')


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

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins