SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <ef...@us...> - 2008年07月20日 00:57:47
Revision: 5793
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5793&view=rev
Author: efiring
Date: 2008年07月20日 00:57:41 +0000 (2008年7月20日)
Log Message:
-----------
Reverting clabel-related change in contour.py to 5689.
contour_demo.py was broken.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2008年07月19日 07:05:43 UTC (rev 5792)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2008年07月20日 00:57:41 UTC (rev 5793)
@@ -17,9 +17,6 @@
 import matplotlib.text as text
 import matplotlib.cbook as cbook
 
-# Import needed for adding manual selection capability to clabel
-from matplotlib.blocking_input import BlockingContourLabeler
-
 # We can't use a single line collection for contour because a line
 # collection can have only a single line style, and we want to be able to have
 # dashed negative contours, for example, and solid positive contours.
@@ -71,17 +68,7 @@
 
 *fmt*:
 a format string for the label. Default is '%1.3f'
- Alternatively, this can be a dictionary matching contour
- levels with arbitrary strings to use for each contour level
- (i.e., fmt[level]=string)
 
- *manual*:
- if *True*, contour labels will be placed manually using
- mouse clicks. Click the first button near a contour to
- add a label, click the second button (or potentially both
- mouse buttons at once) to finish adding labels. The third
- button can be used to remove the last label added, but
- only if labels are not inline.
 
 """
 fontsize = kwargs.get('fontsize', None)
@@ -89,9 +76,8 @@
 self.fmt = kwargs.get('fmt', '%1.3f')
 _colors = kwargs.get('colors', None)
 
- # Detect if manual selection is desired and remove from argument list
- self.manual_select=kwargs.get('manual',False)
 
+
 if len(args) == 0:
 levels = self.levels
 indices = range(len(self.levels))
@@ -140,16 +126,10 @@
 #self.cl_cvalues = [] # same
 self.cl_xy = []
 
- if self.manual_select:
- print 'Select label locations manually using first mouse button.'
- print 'End manual selection with second mouse button.'
- if not inline:
- print 'Remove last label by clicking third mouse button.'
+ self.labels(inline)
 
- blocking_contour_labeler = BlockingContourLabeler(self)
- blocking_contour_labeler(inline)
- else:
- self.labels(inline)
+ for label in self.cl:
+ self.ax.add_artist(label)
 
 self.label_list = cbook.silent_list('text.Text', self.cl)
 return self.label_list
@@ -161,10 +141,10 @@
 if lcsize > 10 * labelwidth:
 return 1
 
- xmax = np.amax(linecontour[:,0])
- xmin = np.amin(linecontour[:,0])
- ymax = np.amax(linecontour[:,1])
- ymin = np.amin(linecontour[:,1])
+ xmax = np.amax(np.array(linecontour)[:,0])
+ xmin = np.amin(np.array(linecontour)[:,0])
+ ymax = np.amax(np.array(linecontour)[:,1])
+ ymin = np.amin(np.array(linecontour)[:,1])
 
 lw = labelwidth
 if (xmax - xmin) > 1.2* lw or (ymax - ymin) > 1.2 * lw:
@@ -213,7 +193,7 @@
 if cbook.is_string_like(lev):
 lw = (len(lev)) * fsize
 else:
- lw = (len(self.get_text(lev,fmt))) * fsize
+ lw = (len(fmt%lev)) * fsize
 
 return lw
 
@@ -230,11 +210,9 @@
 if cbook.is_string_like(lev):
 return lev
 else:
- if isinstance(fmt,dict):
- return fmt[lev]
- else:
- return fmt%lev
+ return fmt%lev
 
+
 def break_linecontour(self, linecontour, rot, labelwidth, ind):
 "break a contour in two contours at the location of the label"
 lcsize = len(linecontour)
@@ -248,8 +226,8 @@
 
 slc = trans.transform(linecontour)
 x,y = slc[ind]
- xx=slc[:,0].copy()
- yy=slc[:,1].copy()
+ xx= np.asarray(slc)[:,0].copy()
+ yy=np.asarray(slc)[:,1].copy()
 
 #indices which are under the label
 inds, = np.nonzero(((xx < x+xlabel) & (xx > x-xlabel)) &
@@ -330,8 +308,8 @@
 else:
 ysize = labelwidth
 
- XX = np.resize(linecontour[:,0],(xsize, ysize))
- YY = np.resize(linecontour[:,1],(xsize, ysize))
+ XX = np.resize(np.asarray(linecontour)[:,0],(xsize, ysize))
+ YY = np.resize(np.asarray(linecontour)[:,1],(xsize, ysize))
 #I might have fouled up the following:
 yfirst = YY[:,0].reshape(xsize, 1)
 ylast = YY[:,-1].reshape(xsize, 1)
@@ -357,85 +335,19 @@
 
 return x,y, rotation, dind
 
- def add_label(self,x,y,rotation,icon):
- dx,dy = self.ax.transData.inverted().transform_point((x,y))
- t = text.Text(dx, dy, rotation = rotation,
- horizontalalignment='center',
- verticalalignment='center')
-
- color = self.label_mappable.to_rgba(self.label_cvalues[icon],
- alpha=self.alpha)
-
- _text = self.get_text(self.label_levels[icon],self.fmt)
- self.set_label_props(t, _text, color)
- self.cl.append(t)
- self.cl_cvalues.append(self.label_cvalues[icon])
- 
- # Add label to plot here - useful for manual mode label selection
- self.ax.add_artist(t)
-
- def pop_label(self,index=-1):
- '''Defaults to removing last label, but any index can be supplied'''
- self.cl_cvalues.pop(index)
- t = self.cl.pop(index)
- t.remove()
-
- def find_nearest_contour( self, x, y, pixel=True ):
- """
- Finds contour that is closest to a point. Defaults to
- measuring distance in pixels (screen space - useful for manual
- contour labeling), but this can be controlled via a keyword
- argument.
-
- Returns a tuple containing the contour, segment, index of
- segment, x & y of segment point and distance to minimum point.
- """
-
- # This function uses a method that is probably quite
- # inefficient based on converting each contour segment to
- # pixel coordinates and then comparing the given point to
- # those coordinates for each contour. This will probably be
- # quite slow for complex contours, but for normal use it works
- # sufficiently well that the time is not noticeable.
- # Nonetheless, improvements could probably be made.
-
- dmin = 1e10
- conmin = None
- segmin = None
- xmin = None
- ymin = None
-
- for icon in self.label_indices:
- con = self.collections[icon]
- paths = con.get_paths()
- for segNum, linepath in enumerate(paths):
- lc = linepath.vertices
-
- # transfer all data points to screen coordinates if desired
- if pixel:
- lc = self.ax.transData.transform(lc)
- 
- ds = (lc[:,0]-x)**2 + (lc[:,1]-y)**2
- d = min( ds )
- if d < dmin:
- dmin = d
- conmin = icon
- segmin = segNum
- imin = mpl.mlab.find( ds == d )[0]
- xmin = lc[imin,0]
- ymin = lc[imin,1]
-
- return (conmin,segmin,imin,xmin,ymin,dmin)
-
 def labels(self, inline):
 levels = self.label_levels
 fslist = self.fslist
 trans = self.ax.transData
-
- for icon, lev, fsize in zip(self.label_indices,
- self.label_levels, fslist):
+ _colors = self.label_mappable.to_rgba(self.label_cvalues,
+ alpha=self.alpha)
+ fmt = self.fmt
+ for icon, lev, color, cvalue, fsize in zip(self.label_indices,
+ self.label_levels,
+ _colors,
+ self.label_cvalues, fslist):
 con = self.collections[icon]
- lw = self.get_label_width(lev, self.fmt, fsize)
+ lw = self.get_label_width(lev, fmt, fsize)
 additions = []
 paths = con.get_paths()
 for segNum, linepath in enumerate(paths):
@@ -450,8 +362,16 @@
 slc = trans.transform(linecontour)
 if self.print_label(slc,lw):
 x,y, rotation, ind = self.locate_label(slc, lw)
- self.add_label(x,y,rotation,icon)
-
+ # transfer the location of the label back to
+ # data coordinates
+ dx,dy = trans.inverted().transform_point((x,y))
+ t = text.Text(dx, dy, rotation = rotation,
+ horizontalalignment='center',
+ verticalalignment='center')
+ _text = self.get_text(lev,fmt)
+ self.set_label_props(t, _text, color)
+ self.cl.append(t)
+ self.cl_cvalues.append(cvalue)
 if inline:
 new = self.break_linecontour(linecontour, rotation, lw, ind)
 if len(new[0]):
@@ -882,8 +802,19 @@
 Use keyword args to control colors, linewidth, origin, cmap ... see
 below for more details.
 
- *X*, *Y*, and *Z* must be arrays with the same dimensions.
+ *X*, *Y*, and *Z* may be arrays all with the same 2-D shape, or
+ *X* and *Y* can be 1-D while *Z* is 2-D. In the latter
+ case, the following must be true:
 
+ ::
+
+ Z.shape == len(Y), len(X)
+
+ Note that the first index of *Z*, the row number, corresponds
+ to the vertical coordinate on the page, while the second
+ index, the column number, corresponds to the horizontal
+ coordinate on the page.
+
 *Z* may be a masked array, but filled contouring may not
 handle internal masked regions correctly.
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <dmk...@us...> - 2008年07月21日 12:59:07
Revision: 5801
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5801&view=rev
Author: dmkaplan
Date: 2008年07月21日 12:58:53 +0000 (2008年7月21日)
Log Message:
-----------
Fixing minor documentation problems in contour.py
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2008年07月21日 12:55:42 UTC (rev 5800)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2008年07月21日 12:58:53 UTC (rev 5801)
@@ -85,7 +85,7 @@
 
 """
 
- """"
+ """
 NOTES on how this all works:
 
 clabel basically takes the input arguments and uses them to
@@ -103,7 +103,7 @@
 
 Once these attributes are set, clabel passes control to the
 labels method (case of automatic label placement) or
- BlockingContourLabeler (case of manual label placement.
+ BlockingContourLabeler (case of manual label placement).
 """
 
 fontsize = kwargs.get('fontsize', None)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2008年09月04日 19:56:39
Revision: 6065
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6065&view=rev
Author: ryanmay
Date: 2008年09月04日 19:56:37 +0000 (2008年9月04日)
Log Message:
-----------
Document the linestyles keyword argument to contour.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2008年09月04日 19:52:42 UTC (rev 6064)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2008年09月04日 19:56:37 UTC (rev 6065)
@@ -998,13 +998,26 @@
 
 *linewidths*: [ None | number | tuple of numbers ]
 If *linewidths* is *None*, the default width in
- ``lines.linewidth`` in ``matplotlibrc`` is used
+ ``lines.linewidth`` in ``matplotlibrc`` is used.
 
 If a number, all levels will be plotted with this linewidth.
 
 If a tuple, different levels will be plotted with different
 linewidths in the order specified
 
+ *linestyles*: [None | 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
+ If *linestyles* is *None*, the 'solid' is used.
+ 
+ *linestyles* can also be an iterable of the above strings
+ specifying a set of linestyles to be used. If this
+ iterable is shorter than the number of contour levels
+ it will be repeated as necessary.
+ 
+ If contour is using a monochrome colormap and the contour
+ level is less than 0, then the linestyle specified
+ in ``contour.negative_linestyle`` in ``matplotlibrc``
+ will be used.
+
 contourf-only keyword arguments:
 
 *antialiased*: [ True | False ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年10月24日 18:16:22
Revision: 6328
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6328&view=rev
Author: mdboom
Date: 2008年10月24日 18:16:12 +0000 (2008年10月24日)
Log Message:
-----------
Fix docstring.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2008年10月24日 17:58:47 UTC (rev 6327)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2008年10月24日 18:16:12 UTC (rev 6328)
@@ -53,8 +53,6 @@
 *fontsize*:
 See http://matplotlib.sf.net/fonts.html
 
- .. TODO: Update this link to new fonts document
-
 *colors*:
 - if *None*, the color of each label matches the color of
 the corresponding contour
@@ -1050,8 +1048,8 @@
 
 Call signature::
 
- conmin,segmin,imin,xmin,ymin,dmin = find_nearest_contour(
- self, x, y, indices=None, pixel=True )
+ conmin,segmin,imin,xmin,ymin,dmin = find_nearest_contour(
+ self, x, y, indices=None, pixel=True )
 
 Optional keyword arguments::
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2008年11月17日 23:08:23
Revision: 6412
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6412&view=rev
Author: efiring
Date: 2008年11月17日 23:08:20 +0000 (2008年11月17日)
Log Message:
-----------
Use autoscale_view for contour plot autoscaling
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2008年11月17日 19:34:28 UTC (rev 6411)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2008年11月17日 23:08:20 UTC (rev 6412)
@@ -625,8 +625,7 @@
 y0 = ma.minimum(y)
 y1 = ma.maximum(y)
 self.ax.update_datalim([(x0,y0), (x1,y1)])
- self.ax.set_xlim((x0, x1))
- self.ax.set_ylim((y0, y1))
+ self.ax.autoscale_view()
 
 def changed(self):
 tcolors = [ (tuple(rgba),) for rgba in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年01月06日 20:31:34
Revision: 6753
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6753&view=rev
Author: efiring
Date: 2009年01月06日 20:31:33 +0000 (2009年1月06日)
Log Message:
-----------
Minor code cleanup in contour
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年01月06日 19:56:03 UTC (rev 6752)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年01月06日 20:31:33 UTC (rev 6753)
@@ -842,10 +842,14 @@
 if linewidths is None:
 tlinewidths = [(mpl.rcParams['lines.linewidth'],)] *Nlev
 else:
- if cbook.iterable(linewidths) and len(linewidths) < Nlev:
- linewidths = list(linewidths) * int(np.ceil(Nlev/len(linewidths)))
- elif not cbook.iterable(linewidths) and type(linewidths) in [int, float]:
+ if not cbook.iterable(linewidths):
 linewidths = [linewidths] * Nlev
+ else:
+ linewidths = list(linewidths)
+ if len(linewidths) < Nlev:
+ linewidths = linewidths * int(np.ceil(Nlev/len(linewidths)))
+ if len(linewidths) > Nlev:
+ linewidths = linewidths[:Nlev]
 tlinewidths = [(w,) for w in linewidths]
 return tlinewidths
 
@@ -862,10 +866,15 @@
 else:
 if cbook.is_string_like(linestyles):
 tlinestyles = [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]
+ elif cbook.iterable(linestyles):
+ tlinestyles = list(linestyles)
+ if len(tlinestyles) < Nlev:
+ nreps = int(np.ceil(Nlev/len(linestyles)))
+ tlinestyles = tlinestyles * nreps
+ if len(tlinestyles) > Nlev:
+ tlinestyles = tlinestyles[:Nlev]
+ else:
+ raise ValueError("Unrecognized type for linestyles kwarg")
 return tlinestyles
 
 def get_alpha(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jr...@us...> - 2009年01月06日 23:38:49
Revision: 6756
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6756&view=rev
Author: jrevans
Date: 2009年01月06日 23:38:46 +0000 (2009年1月06日)
Log Message:
-----------
Fixed a typo, an elif was placed after the else part of an 'if' statement.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年01月06日 20:57:28 UTC (rev 6755)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年01月06日 23:38:46 UTC (rev 6756)
@@ -873,10 +873,10 @@
 tlinestyles = tlinestyles * nreps
 if len(tlinestyles) > Nlev:
 tlinestyles = tlinestyles[:Nlev]
+ elif cbook.iterable(linestyles): # len(linestyles) >= Nlev
+ tlinestyles = list(linestyles)[:Nlev]
 else:
 raise ValueError("Unrecognized type for linestyles kwarg")
- 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.
From: <ef...@us...> - 2009年01月07日 00:07:43
Revision: 6757
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6757&view=rev
Author: efiring
Date: 2009年01月07日 00:07:41 +0000 (2009年1月07日)
Log Message:
-----------
Fix bug introduced in 6755 and modified in 6756--problem using svnmerge?
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年01月06日 23:38:46 UTC (rev 6756)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年01月07日 00:07:41 UTC (rev 6757)
@@ -873,8 +873,6 @@
 tlinestyles = tlinestyles * nreps
 if len(tlinestyles) > Nlev:
 tlinestyles = tlinestyles[:Nlev]
- elif cbook.iterable(linestyles): # len(linestyles) >= Nlev
- tlinestyles = list(linestyles)[:Nlev]
 else:
 raise ValueError("Unrecognized type for linestyles kwarg")
 return tlinestyles
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <mme...@us...> - 2009年01月08日 19:58:31
Revision: 6769
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6769&view=rev
Author: mmetz_bn
Date: 2009年01月08日 19:58:26 +0000 (2009年1月08日)
Log Message:
-----------
Minor code cleanup in contour
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年01月08日 19:55:06 UTC (rev 6768)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年01月08日 19:58:26 UTC (rev 6769)
@@ -840,15 +840,16 @@
 linewidths = self.linewidths
 Nlev = len(self.levels)
 if linewidths is None:
- tlinewidths = [(mpl.rcParams['lines.linewidth'],)] *Nlev
+ tlinewidths = [(mpl.rcParams['lines.linewidth'],)] * Nlev
 else:
 if not cbook.iterable(linewidths):
 linewidths = [linewidths] * Nlev
 else:
 linewidths = list(linewidths)
 if len(linewidths) < Nlev:
- linewidths = linewidths * int(np.ceil(Nlev/len(linewidths)))
- if len(linewidths) > Nlev:
+ nreps = int(np.ceil(Nlev/len(linewidths)))
+ linewidths = linewidths * nreps
+ elif len(linewidths) > Nlev:
 linewidths = linewidths[:Nlev]
 tlinewidths = [(w,) for w in linewidths]
 return tlinewidths
@@ -871,7 +872,7 @@
 if len(tlinestyles) < Nlev:
 nreps = int(np.ceil(Nlev/len(linestyles)))
 tlinestyles = tlinestyles * nreps
- if len(tlinestyles) > Nlev:
+ elif len(tlinestyles) > Nlev:
 tlinestyles = tlinestyles[:Nlev]
 else:
 raise ValueError("Unrecognized type for linestyles kwarg")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年01月08日 22:11:14
Revision: 6770
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6770&view=rev
Author: efiring
Date: 2009年01月08日 22:11:09 +0000 (2009年1月08日)
Log Message:
-----------
Fix bugs introduced in 6769
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年01月08日 19:58:26 UTC (rev 6769)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年01月08日 22:11:09 UTC (rev 6770)
@@ -849,7 +849,7 @@
 if len(linewidths) < Nlev:
 nreps = int(np.ceil(Nlev/len(linewidths)))
 linewidths = linewidths * nreps
- elif len(linewidths) > Nlev:
+ if len(linewidths) > Nlev:
 linewidths = linewidths[:Nlev]
 tlinewidths = [(w,) for w in linewidths]
 return tlinewidths
@@ -872,7 +872,7 @@
 if len(tlinestyles) < Nlev:
 nreps = int(np.ceil(Nlev/len(linestyles)))
 tlinestyles = tlinestyles * nreps
- elif len(tlinestyles) > Nlev:
+ if len(tlinestyles) > Nlev:
 tlinestyles = tlinestyles[:Nlev]
 else:
 raise ValueError("Unrecognized type for linestyles kwarg")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年08月04日 18:09:49
Revision: 7350
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7350&view=rev
Author: efiring
Date: 2009年08月04日 18:09:38 +0000 (2009年8月04日)
Log Message:
-----------
Fix typo in recent change to contour.py.
(There are still bugs to be found in the change to cntr.c.)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2009年08月04日 17:59:44 UTC (rev 7349)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2009年08月04日 18:09:38 UTC (rev 7350)
@@ -652,7 +652,7 @@
 codes = np.zeros(kind.shape, dtype=mpath.Path.code_type)
 codes.fill(mpath.Path.LINETO)
 codes[0] = mpath.Path.MOVETO
- codes[kinds >= _cntr._slitkind] = mpath.Path.MOVETO
+ codes[kind >= _cntr._slitkind] = mpath.Path.MOVETO
 paths.append(mpath.Path(seg, codes))
 return paths
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年01月02日 06:30:21
Revision: 8063
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8063&view=rev
Author: efiring
Date: 2010年01月02日 06:30:15 +0000 (2010年1月02日)
Log Message:
-----------
Include contourf examples in documentation
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年01月02日 05:20:47 UTC (rev 8062)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年01月02日 06:30:15 UTC (rev 8063)
@@ -987,9 +987,8 @@
 signatures and return values are the same for both versions.
 
 :func:`~matplotlib.pyplot.contourf` differs from the Matlab
- (TM) version in that it does not draw the polygon edges,
- because the contouring engine yields simply connected regions
- with branch cuts. To draw the edges, add line contours with
+ (TM) version in that it does not draw the polygon edges.
+ To draw edges, add line contours with
 calls to :func:`~matplotlib.pyplot.contour`.
 
 
@@ -1142,9 +1141,11 @@
 be removed. Chunking introduces artifacts at the chunk boundaries
 unless *antialiased* is *False*.
 
- **Example:**
+ **Examples:**
 
 .. plot:: mpl_examples/pylab_examples/contour_demo.py
+
+ .. plot:: mpl_examples/pylab_examples/contourf_demo.py
 """
 
 def find_nearest_contour( self, x, y, indices=None, pixel=True ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年01月22日 02:18:19
Revision: 8093
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8093&view=rev
Author: efiring
Date: 2010年01月22日 02:18:13 +0000 (2010年1月22日)
Log Message:
-----------
Contourf: change method of making bottom bound include zmin.
This avoids a problem in colorbar tick labeling when zmin is 0.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年01月19日 00:26:16 UTC (rev 8092)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年01月22日 02:18:13 UTC (rev 8093)
@@ -676,8 +676,17 @@
 if self.filled:
 if self.linewidths is not None:
 warnings.warn('linewidths is ignored by contourf')
+
 lowers = self._levels[:-1]
+ if self.zmin == lowers[0]:
+ # Include minimum values in lowest interval
+ lowers = lowers.copy() # so we don't change self._levels
+ if self.logscale:
+ lowers[0] = 0.99 * self.zmin
+ else:
+ lowers[0] -= 1
 uppers = self._levels[1:]
+
 for level, level_upper in zip(lowers, uppers):
 nlist = C.trace(level, level_upper, nchunk = self.nchunk)
 nseg = len(nlist)//2
@@ -756,14 +765,6 @@
 zmin = self.zmin
 self.locator.set_bounds(zmin, zmax)
 lev = self.locator()
- zmargin = (zmax - zmin) * 0.000001 # so z < (zmax + zmargin)
- if zmax >= lev[-1]:
- lev[-1] += zmargin
- if zmin <= lev[0]:
- if self.logscale:
- lev[0] = 0.99 * zmin
- else:
- lev[0] -= zmargin
 self._auto = True
 if self.filled:
 return lev
@@ -1141,6 +1142,15 @@
 be removed. Chunking introduces artifacts at the chunk boundaries
 unless *antialiased* is *False*.
 
+ Note: contourf fills intervals that are closed at the top; that
+ is, for boundaries *z1* and *z2*, the filled region is::
+
+ z1 < z <= z2
+
+ There is one exception: if the lowest boundary coincides with
+ the minimum value of the *z* array, then that minimum value
+ will be included in the lowest interval.
+
 **Examples:**
 
 .. plot:: mpl_examples/pylab_examples/contour_demo.py
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年01月22日 23:47:21
Revision: 8094
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8094&view=rev
Author: efiring
Date: 2010年01月22日 23:47:14 +0000 (2010年1月22日)
Log Message:
-----------
Fix units support for contour and contourf
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年01月22日 02:18:13 UTC (rev 8093)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年01月22日 23:47:14 UTC (rev 8094)
@@ -643,7 +643,7 @@
 if self.levels is None:
 self.levels = args[0].levels
 else:
- x, y, z = self._contour_args(*args)
+ x, y, z = self._contour_args(args, kwargs)
 
 x0 = ma.minimum(x)
 x1 = ma.maximum(x)
@@ -808,7 +808,7 @@
 y = y[::-1]
 return np.meshgrid(x,y)
 
- def _check_xyz(self, args):
+ def _check_xyz(self, args, kwargs):
 '''
 For functions like contour, check that the dimensions
 of the input arrays match; if x and y are 1D, convert
@@ -817,9 +817,10 @@
 Possible change: I think we should make and use an ArgumentError
 Exception class (here and elsewhere).
 '''
- # We can strip away the x and y units
- x = self.ax.convert_xunits( args[0] )
- y = self.ax.convert_yunits( args[1] )
+ x, y = args[:2]
+ self.ax._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
+ x = self.ax.convert_xunits(x)
+ y = self.ax.convert_yunits(y)
 
 x = np.asarray(x, dtype=np.float64)
 y = np.asarray(y, dtype=np.float64)
@@ -840,8 +841,7 @@
 return x,y,z
 
 
-
- def _contour_args(self, *args):
+ def _contour_args(self, args, kwargs):
 if self.filled: fn = 'contourf'
 else: fn = 'contour'
 Nargs = len(args)
@@ -849,7 +849,7 @@
 z = ma.asarray(args[0], dtype=np.float64)
 x, y = self._initialize_x_y(z)
 elif Nargs <=4:
- x,y,z = self._check_xyz(args[:3])
+ x,y,z = self._check_xyz(args[:3], kwargs)
 else:
 raise TypeError("Too many arguments to %s; see help(%s)" % (fn,fn))
 z = ma.masked_invalid(z, copy=False)
@@ -1103,9 +1103,14 @@
 are included. These added ranges are then mapped to the
 special colormap values which default to the ends of the
 colormap range, but can be set via
- :meth:`matplotlib.cm.Colormap.set_under` and
- :meth:`matplotlib.cm.Colormap.set_over` methods.
+ :meth:`matplotlib.colors.Colormap.set_under` and
+ :meth:`matplotlib.colors.Colormap.set_over` methods.
 
+ *xunits*, *yunits*: [ None | registered units ]
+ Override axis units by specifying an instance of a
+ :class:`matplotlib.units.ConversionInterface`.
+
+
 contour-only keyword arguments:
 
 *linewidths*: [ None | number | tuple of numbers ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2010年01月28日 19:09:28
Revision: 8098
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8098&view=rev
Author: ryanmay
Date: 2010年01月28日 19:09:20 +0000 (2010年1月28日)
Log Message:
-----------
Support setting zorder keyword for ContourSet.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年01月25日 20:31:41 UTC (rev 8097)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年01月28日 19:09:20 UTC (rev 8098)
@@ -695,10 +695,13 @@
 
 paths = self._make_paths(segs, kinds)
 
+ # Default zorder taken from Collection
+ zorder = kwargs.get('zorder', 1)
 col = collections.PathCollection(paths,
 antialiaseds = (self.antialiased,),
 edgecolors= 'none',
- alpha=self.alpha)
+ alpha=self.alpha,
+ zorder=zorder)
 self.ax.add_collection(col)
 self.collections.append(col)
 else:
@@ -710,10 +713,14 @@
 nseg = len(nlist)//2
 segs = nlist[:nseg]
 #kinds = nlist[nseg:]
+
+ # Default zorder taken from LineCollection
+ zorder = kwargs.get('zorder', 2)
 col = collections.LineCollection(segs,
 linewidths = width,
 linestyle = lstyle,
- alpha=self.alpha)
+ alpha=self.alpha,
+ zorder=zorder)
 
 col.set_label('_nolegend_')
 self.ax.add_collection(col, False)
@@ -1228,4 +1235,3 @@
 ymin = lc[imin,1]
 
 return (conmin,segmin,imin,xmin,ymin,dmin)
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年03月13日 19:27:07
Revision: 8190
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8190&view=rev
Author: efiring
Date: 2010年03月13日 19:27:00 +0000 (2010年3月13日)
Log Message:
-----------
contour: autolev drops line contour levels only if outside data range
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年03月12日 23:23:49 UTC (rev 8189)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年03月13日 19:27:00 UTC (rev 8190)
@@ -775,7 +775,8 @@
 self._auto = True
 if self.filled:
 return lev
- return lev[1:-1]
+ # For line contours, drop levels outside the data range.
+ return lev[(lev > zmin) & (lev < zmax)]
 
 def _initialize_x_y(self, z):
 '''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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 によって変換されたページ (->オリジナル) /