Revision: 6434
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6434&view=rev
Author: jdh2358
Date: 2008-11-23 19:15:01 +0000 (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.py 2008-11-23 19:05:58 UTC
(rev 6433)
+++ trunk/matplotlib/examples/api/fill_where_demo.py 2008-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