From: <ef...@us...> - 2007-10-05 06:18:27
|
Revision: 3918 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3918&view=rev Author: efiring Date: 2007-10-04 23:18:25 -0700 (Thu, 04 Oct 2007) Log Message: ----------- Minor cleanup of arguments and docstring in contour Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2007-10-04 22:13:18 UTC (rev 3917) +++ trunk/matplotlib/lib/matplotlib/contour.py 2007-10-05 06:18:25 UTC (rev 3918) @@ -397,12 +397,7 @@ cmap = kwargs.get('cmap', None) self.colors = kwargs.get('colors', None) norm = kwargs.get('norm', None) - self.clip_ends = kwargs.get('clip_ends', None) ######## self.extend = kwargs.get('extend', 'neither') - if self.clip_ends is not None: - warnings.warn("'clip_ends' has been replaced by 'extend'") - self.levels = self.levels[1:-1] # discard specified end levels - self.extend = 'both' # regenerate end levels self.antialiased = kwargs.get('antialiased', True) self.nchunk = kwargs.get('nchunk', 0) self.locator = kwargs.get('locator', None) @@ -436,10 +431,8 @@ _mask = None if self.filled: - if self.linewidths is None: - self.linewidths = 0.05 # Good default for Postscript. - if cbook.iterable(self.linewidths): - self.linewidths = self.linewidths[0] + if self.linewidths is not None: + warnings.warn('linewidths is ignored by contourf') C = _cntr.Cntr(x, y, z.filled(), _mask) lowers = self._levels[:-1] uppers = self._levels[1:] @@ -447,7 +440,6 @@ nlist = C.trace(level, level_upper, points = 0, nchunk = self.nchunk) col = collections.PolyCollection(nlist, - linewidths = (self.linewidths,), antialiaseds = (self.antialiased,), edgecolors= 'None') self.ax.add_collection(col) @@ -627,16 +619,16 @@ self._levels = npy.asarray(self._levels) self.vmin = npy.amin(self.levels) # alternative would be self.layers self.vmax = npy.amax(self.levels) - if self.extend in ('both', 'min') or self.clip_ends: + if self.extend in ('both', 'min'): self.vmin = 2 * self.levels[0] - self.levels[1] - if self.extend in ('both', 'max') or self.clip_ends: + if self.extend in ('both', 'max'): self.vmax = 2 * self.levels[-1] - self.levels[-2] self.layers = self._levels # contour: a line is a thin layer if self.filled: self.layers = 0.5 * (self._levels[:-1] + self._levels[1:]) - if self.extend in ('both', 'min') or self.clip_ends: + if self.extend in ('both', 'min'): self.layers[0] = 0.5 * (self.vmin + self._levels[1]) - if self.extend in ('both', 'max') or self.clip_ends: + if self.extend in ('both', 'max'): self.layers[-1] = 0.5 * (self.vmax + self._levels[-2]) return (x, y, z) @@ -774,7 +766,6 @@ contour levels if they are not given explicitly via the V argument. - ***** New: ***** * extend = 'neither', 'both', 'min', 'max' Unless this is 'neither' (default), contour levels are automatically added to one or both ends of the range so that @@ -782,8 +773,7 @@ mapped to the special colormap values which default to the ends of the colormap range, but can be set via Colormap.set_under() and Colormap.set_over() methods. - To replace clip_ends=True and V = [-100, 2, 1, 0, 1, 2, 100], - use extend='both' and V = [2, 1, 0, 1, 2]. + **************** contour only: @@ -799,29 +789,13 @@ matplotlibrc is used contourf only: - ***** Obsolete: **** - * clip_ends = True - If False, the limits for color scaling are set to the - minimum and maximum contour levels. - True (default) clips the scaling limits. Example: - if the contour boundaries are V = [-100, 2, 1, 0, 1, 2, 100], - then the scaling limits will be [-100, 100] if clip_ends - is False, and [-3, 3] if clip_ends is True. - * linewidths = None or a number; default of 0.05 works for - Postscript; a value of about 0.5 seems better for Agg. - * antialiased = True (default) or False; if False, there is - no need to increase the linewidths for Agg, but True gives - nicer color boundaries. If antialiased is True and linewidths - is too small, then there may be light-colored lines at the - color boundaries caused by the antialiasing. + * antialiased = True (default) or False * nchunk = 0 (default) for no subdivision of the domain; specify a positive integer to divide the domain into subdomains of roughly nchunk by nchunk points. This may never actually be advantageous, so this option may be removed. Chunking introduces artifacts at the chunk - boundaries unless antialiased = False, or linewidths is - set to a large enough value for the particular renderer and - resolution. + boundaries unless antialiased = False """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-02-05 07:34:41
|
Revision: 4939 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4939&view=rev Author: efiring Date: 2008-02-04 23:34:39 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Bugfix in contour auto level selection via locator Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008-02-04 19:53:07 UTC (rev 4938) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008-02-05 07:34:39 UTC (rev 4939) @@ -514,12 +514,11 @@ self.locator = ticker.LogLocator() else: self.locator = ticker.MaxNLocator(N+1) - self.locator.create_dummy_axis() - locator = self.locator + self.locator.create_dummy_axis() zmax = self.zmax zmin = self.zmin - locator.set_bounds(zmin, zmax) - lev = locator() + 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-20 00:57:45
|
Revision: 5051 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5051&view=rev Author: efiring Date: 2008-04-19 17:57:40 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Make alpha work for contour and contourf (thanks to Stephane Raynaud) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008-04-19 14:22:11 UTC (rev 5050) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008-04-20 00:57:40 UTC (rev 5051) @@ -325,7 +325,8 @@ levels = self.label_levels fslist = self.fslist trans = self.ax.transData - _colors = self.label_mappable.to_rgba(self.label_cvalues) + _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, @@ -456,7 +457,8 @@ nchunk = self.nchunk) col = collections.PolyCollection(nlist, antialiaseds = (self.antialiased,), - edgecolors= 'None') + edgecolors= 'none', + alpha=self.alpha) self.ax.add_collection(col) self.collections.append(col) @@ -469,7 +471,8 @@ nlist = C.trace(level, points = 0) col = collections.LineCollection(nlist, linewidths = width, - linestyle = lstyle) + linestyle = lstyle, + alpha=self.alpha) if level < 0.0 and self.monochrome: ls = mpl.rcParams['contour.negative_linestyle'] @@ -491,8 +494,10 @@ self.to_rgba(self.cvalues, alpha=self.alpha)] self.tcolors = tcolors for color, collection in zip(tcolors, self.collections): + collection.set_alpha(self.alpha) collection.set_color(color) for label, cv in zip(self.cl, self.cl_cvalues): + label.set_alpha(self.alpha) label.set_color(self.label_mappable.to_rgba(cv)) # add label colors cm.ScalarMappable.changed(self) @@ -718,11 +723,11 @@ return tlinestyles def get_alpha(self): - '''For compatibility with artists, return self.alpha''' + '''returns alpha to be applied to all ContourSet artists''' return self.alpha def set_alpha(self, alpha): - '''For compatibility with artists, set self.alpha''' + '''sets alpha for all ContourSet artists''' self.alpha = alpha self.changed() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |