SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
2
3
4
(1)
5
(6)
6
(1)
7
(5)
8
(4)
9
(7)
10
(2)
11
(12)
12
(2)
13
(1)
14
(4)
15
16
17
(7)
18
(2)
19
(3)
20
(8)
21
(6)
22
23
(9)
24
(4)
25
(9)
26
(2)
27
28
29
(2)
30
(1)






Showing 9 results of 9

From: <jd...@us...> - 2008年11月23日 20:15:39
Revision: 6440
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6440&view=rev
Author: jdh2358
Date: 2008年11月23日 20:15:36 +0000 (2008年11月23日)
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.
Revision: 6439
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6439&view=rev
Author: jdh2358
Date: 2008年11月23日 20:09:08 +0000 (2008年11月23日)
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.py	2008年11月23日 19:57:18 UTC (rev 6438)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2008年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.
Revision: 6438
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6438&view=rev
Author: jdh2358
Date: 2008年11月23日 19:57:18 +0000 (2008年11月23日)
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.py	2008年11月23日 19:56:37 UTC (rev 6437)
+++ trunk/matplotlib/examples/api/fill_where_demo.py	2008年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.
From: <jd...@us...> - 2008年11月23日 19:56:41
Revision: 6437
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6437&view=rev
Author: jdh2358
Date: 2008年11月23日 19:56:37 +0000 (2008年11月23日)
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 @@
 </td>
 
 </tr>
+
 <tr>
 <th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.fill_between">fill_between</a>
+
+ </th>
+
+ <td align="left">
+ make filled polygons between two curves
+ </td>
+
+ </tr>
+
+ <tr>
+ <th align="left">
 <a href="api/pyplot_api.html#matplotlib.pyplot.findobj">findobj</a>
 
 </th>
Modified: trunk/matplotlib/examples/api/fill_where_demo.py
===================================================================
--- trunk/matplotlib/examples/api/fill_where_demo.py	2008年11月23日 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/examples/api/fill_where_demo.py	2008年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.py	2008年11月23日 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2008年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()
 
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2008年11月23日 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2008年11月23日 19:56:37 UTC (rev 6437)
@@ -1302,6 +1302,7 @@
 if autolim:
 if collection._paths and len(collection._paths):
 self.update_datalim(collection.get_datalim(self.transData))
+
 collection._remove_method = lambda h: self.collections.remove(h)
 
 def add_line(self, line):
@@ -5456,12 +5457,8 @@
 supports are supported by the fill format string.
 
 If you would like to fill below a curve, eg. shade a region
- between 0 and *y* along *x*, use
- :func:`~matplotlib.pylab.poly_between`, eg.::
+ between 0 and *y* along *x*, use :meth:`fill_between`
 
- xs, ys = poly_between(x, 0, y)
- axes.fill(xs, ys, facecolor='red', alpha=0.5)
-
 The *closed* kwarg will close the polygon when *True* (default).
 
 kwargs control the Polygon properties:
@@ -5472,9 +5469,6 @@
 
 .. plot:: mpl_examples/pylab_examples/fill_demo.py
 
- .. seealso::
- :file:`examples/pylab_examples/fill_between.py`:
- For more examples.
 """
 if not self._hold: self.cla()
 
@@ -5486,6 +5480,92 @@
 return patches
 fill.__doc__ = cbook.dedent(fill.__doc__) % martist.kwdocd
 
+ def fill_between(self, x, y1, y2=0, where=None, **kwargs):
+ """
+ call signature::
+
+ fill_between(x, y1, y2=0, where=None, **kwargs)
+
+ Create a :class:`~matplotlib.collectionsPolyCollection`
+ filling the regions between *y1* and *y2* where
+ ``where==True``
+
+ *x*
+ an N length np array of the x 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
+
+ *where*
+ if None, default to fill between everywhere. If not None,
+ it is a a N length numpy boolean array and the fill will
+ only happen over the regions where ``where==True``
+
+ *kwargs*
+ keyword args passed on to the :class:`PolyCollection`
+
+ .. seealso::
+ :file:`examples/pylab_examples/fill_between.py`:
+ For more examples.
+
+ kwargs control the Polygon properties:
+
+ %(PolyCollection)s
+
+ """
+ x = np.asarray(x)
+	if not cbook.iterable(y1):
+	 y1 = np.ones_like(x)*y1
+
+	if not cbook.iterable(y2):
+	 y2 = np.ones_like(x)*y2
+
+	if where is None:
+	 where = np.ones(len(x), np.bool)
+
+ y1 = np.asarray(y1)
+ y2 = np.asarray(y2)
+ where = np.asarray(where)
+ assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where))
+
+ polys = []
+ for ind0, ind1 in mlab.contiguous_regions(where):
+ theseverts = []
+ xslice = x[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)
+
+ # 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] = y1slice
+ X[N+2:,0] = xslice[::-1]
+ X[N+2:,1] = y2slice[::-1]
+
+ polys.append(X)
+
+ collection = mcoll.PolyCollection(polys, **kwargs)
+
+ self.update_datalim_numerix(x[where], y1[where])
+ self.update_datalim_numerix(x[where], y2[where])
+ self.add_collection(collection)
+ self.autoscale_view()
+ return collection
+ fill_between.__doc__ = cbook.dedent(fill_between.__doc__) % martist.kwdocd
+
 #### plotting z(x,y): imshow, pcolor and relatives, contour
 
 def imshow(self, X, cmap=None, norm=None, aspect=None,
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2008年11月23日 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2008年11月23日 19:56:37 UTC (rev 6437)
@@ -673,66 +673,6 @@
 return Collection.draw(self, renderer)
 
 
- @staticmethod
- def fill_between_where(x, y1, y2, where, **kwargs):
- """
- Create a :class:`PolyCollection` filling the regions between *y*
- and *yboundary7* where ``where==True``
-
-
- *x*
- an N length np array of the x 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
-
- *where*
- an N length numpy boolean array
-
- *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(where):
- theseverts = []
- xslice = x[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)
-
- # 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] = y1slice
- X[N+2:,0] = xslice[::-1]
- X[N+2:,1] = y2slice[::-1]
-
- polys.append(X)
-
- collection = PolyCollection(polys, **kwargs)
- return collection
-
 class BrokenBarHCollection(PolyCollection):
 """
 A collection of horizontal bars spanning *yrange* with a sequence of
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2008年11月23日 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2008年11月23日 19:56:37 UTC (rev 6437)
@@ -1120,61 +1120,62 @@
 """
 Plotting commands
 
- ========= =================================================
- Command Description
- ========= =================================================
- axes Create a new axes
- axis Set or return the current axis limits
- bar make a bar chart
- boxplot make a box and whiskers chart
- cla clear current axes
- clabel label a contour plot
- clf clear a figure window
- close close a figure window
- colorbar add a colorbar to the current figure
- cohere make a plot of coherence
- contour make a contour plot
- contourf make a filled contour plot
- csd make a plot of cross spectral density
- draw force a redraw of the current figure
- errorbar make an errorbar graph
- figlegend add a legend to the figure
- figimage add an image to the figure, w/o resampling
- figtext add text in figure coords
- figure create or change active figure
- fill make filled polygons
- gca return the current axes
- gcf return the current figure
- gci get the current image, or None
- getp get a handle graphics property
- hist make a histogram
- hold set the hold state on current axes
- legend add a legend to the axes
- loglog a log log plot
- imread load image file into array
- imshow plot image data
- matshow display a matrix in a new figure preserving aspect
- pcolor make a pseudocolor plot
- plot make a line plot
- plotfile plot data from a flat file
- psd make a plot of power spectral density
- quiver make a direction field (arrows) plot
- rc control the default params
- savefig save the current figure
- scatter make a scatter plot
- setp set a handle graphics property
- semilogx log x axis
- semilogy log y axis
- show show the figures
- specgram a spectrogram plot
- stem make a stem plot
- subplot make a subplot (numrows, numcols, axesnum)
- table add a table to the axes
- text add some text at location x,y to the current axes
- title add a title to the current axes
- xlabel add an xlabel to the current axes
- ylabel add a ylabel to the current axes
- ========= =================================================
+ ========= =================================================
+ Command Description
+ ========= =================================================
+ axes Create a new axes
+ axis Set or return the current axis limits
+ bar make a bar chart
+ boxplot make a box and whiskers chart
+ cla clear current axes
+ clabel label a contour plot
+ clf clear a figure window
+ close close a figure window
+ colorbar add a colorbar to the current figure
+ cohere make a plot of coherence
+ contour make a contour plot
+ contourf make a filled contour plot
+ csd make a plot of cross spectral density
+ draw force a redraw of the current figure
+ errorbar make an errorbar graph
+ figlegend add a legend to the figure
+ figimage add an image to the figure, w/o resampling
+ figtext add text in figure coords
+ figure create or change active figure
+ fill make filled polygons
+ fill_between make filled polygons
+ gca return the current axes
+ gcf return the current figure
+ gci get the current image, or None
+ getp get a handle graphics property
+ hist make a histogram
+ hold set the hold state on current axes
+ legend add a legend to the axes
+ loglog a log log plot
+ imread load image file into array
+ imshow plot image data
+ matshow display a matrix in a new figure preserving aspect
+ pcolor make a pseudocolor plot
+ plot make a line plot
+ plotfile plot data from a flat file
+ psd make a plot of power spectral density
+ quiver make a direction field (arrows) plot
+ rc control the default params
+ savefig save the current figure
+ scatter make a scatter plot
+ setp set a handle graphics property
+ semilogx log x axis
+ semilogy log y axis
+ show show the figures
+ specgram a spectrogram plot
+ stem make a stem plot
+ subplot make a subplot (numrows, numcols, axesnum)
+ table add a table to the axes
+ text add some text at location x,y to the current axes
+ title add a title to the current axes
+ xlabel add an xlabel to the current axes
+ ylabel add a ylabel to the current axes
+ ========= =================================================
 
 The following commands will set the default colormap accordingly:
 
@@ -1493,7 +1494,6 @@
 ## Plotting part 2: autogenerated wrappers for axes methods ##
 
 
-### Do not edit below this point
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 def acorr(*args, **kwargs):
@@ -1870,6 +1870,50 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
+def fill_between(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().fill_between(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+
+ hold(b)
+ return ret
+if Axes.fill_between.__doc__ is not None:
+ fill_between.__doc__ = dedent(Axes.fill_between.__doc__) + """
+
+Additional kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
+def hexbin(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().hexbin(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+ gci._current = ret
+ hold(b)
+ return ret
+if Axes.hexbin.__doc__ is not None:
+ hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """
+
+Additional kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
 def hist(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
@@ -2156,28 +2200,6 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
-def hexbin(*args, **kwargs):
- # allow callers to override the hold state by passing hold=True|False
- b = ishold()
- h = kwargs.pop('hold', None)
- if h is not None:
- hold(h)
- try:
- ret = gca().hexbin(*args, **kwargs)
- draw_if_interactive()
- except:
- hold(b)
- raise
- gci._current = ret
- hold(b)
- return ret
-if Axes.hexbin.__doc__ is not None:
- hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py. Do not edit as
-# changes will be lost
 def semilogx(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
@@ -2438,10 +2460,8 @@
 # changes will be lost
 def autumn():
 '''
- Set the default colormap to *autumn* and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to autumn and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='autumn')
 im = gci()
@@ -2455,10 +2475,8 @@
 # changes will be lost
 def bone():
 '''
- Set the default colormap to bone and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to bone and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='bone')
 im = gci()
@@ -2472,10 +2490,8 @@
 # changes will be lost
 def cool():
 '''
- Set the default colormap to cool and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to cool and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='cool')
 im = gci()
@@ -2489,10 +2505,8 @@
 # changes will be lost
 def copper():
 '''
- Set the default colormap to copper and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to copper and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='copper')
 im = gci()
@@ -2506,10 +2520,8 @@
 # changes will be lost
 def flag():
 '''
- Set the default colormap to flag and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to flag and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='flag')
 im = gci()
@@ -2523,10 +2535,8 @@
 # changes will be lost
 def gray():
 '''
- Set the default colormap to gray and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to gray and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='gray')
 im = gci()
@@ -2540,10 +2550,8 @@
 # changes will be lost
 def hot():
 '''
- Set the default colormap to hot and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to hot and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='hot')
 im = gci()
@@ -2557,10 +2565,8 @@
 # changes will be lost
 def hsv():
 '''
- Set the default colormap to hsv and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to hsv and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='hsv')
 im = gci()
@@ -2574,10 +2580,8 @@
 # changes will be lost
 def jet():
 '''
- Set the default colormap to jet and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to jet and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='jet')
 im = gci()
@@ -2591,10 +2595,8 @@
 # changes will be lost
 def pink():
 '''
- Set the default colormap to pink and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to pink and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='pink')
 im = gci()
@@ -2608,10 +2610,8 @@
 # changes will be lost
 def prism():
 '''
- Set the default colormap to prism and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to prism and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='prism')
 im = gci()
@@ -2625,10 +2625,8 @@
 # changes will be lost
 def spring():
 '''
- Set the default colormap to spring and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to spring and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='spring')
 im = gci()
@@ -2642,10 +2640,8 @@
 # changes will be lost
 def summer():
 '''
- Set the default colormap to summer and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to summer and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='summer')
 im = gci()
@@ -2659,10 +2655,8 @@
 # changes will be lost
 def winter():
 '''
- Set the default colormap to winter and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to winter and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='winter')
 im = gci()
@@ -2676,10 +2670,8 @@
 # changes will be lost
 def spectral():
 '''
- Set the default colormap to spectral and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to spectral and apply to current image if any.
+ See help(colormaps) for more information
 '''
 rc('image', cmap='spectral')
 im = gci()
@@ -2687,3 +2679,5 @@
 if im is not None:
 im.set_cmap(cm.spectral)
 draw_if_interactive()
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2008年11月23日 19:18:29
Revision: 6436
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6436&view=rev
Author: jdh2358
Date: 2008年11月23日 19:18:24 +0000 (2008年11月23日)
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.
Revision: 6435
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6435&view=rev
Author: jdh2358
Date: 2008年11月23日 19:16:40 +0000 (2008年11月23日)
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 <bo...@ll...>
-Subject: possible candidate for examples directory using fill
-To: John Hunter <jdh...@ni...>
-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.
From: <jd...@us...> - 2008年11月23日 19:15:04
Revision: 6434
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6434&view=rev
Author: jdh2358
Date: 2008年11月23日 19:15:01 +0000 (2008年11月23日)
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.
From: <jd...@us...> - 2008年11月23日 19:06:02
Revision: 6433
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6433&view=rev
Author: jdh2358
Date: 2008年11月23日 19:05:58 +0000 (2008年11月23日)
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.py	2008年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.
From: <jd...@us...> - 2008年11月23日 19:04:40
Revision: 6432
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6432&view=rev
Author: jdh2358
Date: 2008年11月23日 19:04:35 +0000 (2008年11月23日)
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.

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /