|
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 (Fri, 22 Jan 2010)
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.
|