Revision: 3628
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3628&view=rev
Author: efiring
Date: 2007-07-29 19:04:46 -0700 (Sun, 29 Jul 2007)
Log Message:
-----------
changed pcolor default to shading='flat'; related cleanups
Modified Paths:
--------------
trunk/matplotlib/API_CHANGES
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pcolor_demo.py
trunk/matplotlib/examples/pcolor_log.py
trunk/matplotlib/examples/pcolor_small.py
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES 2007-07-29 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/API_CHANGES 2007-07-30 02:04:46 UTC (rev 3628)
@@ -1,3 +1,6 @@
+ Changed pcolor default to shading='flat'; but as noted now in the
+ docstring, it is preferable to simply use the edgecolor kwarg.
+
The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX
does: they are in effect until the next font change command or the
end of the grouping. Therefore uses of $\cal{R}$ should be
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2007-07-29 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/CHANGELOG 2007-07-30 02:04:46 UTC (rev 3628)
@@ -1,54 +1,58 @@
+2007-07-29 Changed default pcolor shading to flat; added aliases
+ to make collection kwargs agree with setter names, so
+ updating works; related minor cleanups.
+
2007-07-26 Major rewrite of mathtext.py, using the TeX box layout model.
- There is one (known) backward incompatible change. The
- font commands (\cal, \rm, \it, \tt) now behave as TeX does:
- they are in effect until the next font change command or
- the end of the grouping. Therefore uses of $\cal{R}$
- should be changed to ${\cal R}$. Alternatively, you may
- use the new LaTeX-style font commands (\mathcal, \mathrm,
- \mathit, \mathtt) which do affect the following group,
- eg. $\mathcal{R}$.
+ There is one (known) backward incompatible change. The
+ font commands (\cal, \rm, \it, \tt) now behave as TeX does:
+ they are in effect until the next font change command or
+ the end of the grouping. Therefore uses of $\cal{R}$
+ should be changed to ${\cal R}$. Alternatively, you may
+ use the new LaTeX-style font commands (\mathcal, \mathrm,
+ \mathit, \mathtt) which do affect the following group,
+ eg. $\mathcal{R}$.
- Other new features include:
+ Other new features include:
- - Math may be interspersed with non-math text. Any text
+ - Math may be interspersed with non-math text. Any text
with an even number of $'s (non-escaped) will be sent to
- the mathtext parser for layout.
+ the mathtext parser for layout.
- - Sub/superscripts are less likely to accidentally overlap.
+ - Sub/superscripts are less likely to accidentally overlap.
- - Support for sub/superscripts in either order, eg. $x^i_j$
+ - Support for sub/superscripts in either order, eg. $x^i_j$
and $x_j^i$ are equivalent.
- - Double sub/superscripts (eg. $x_i_j$) are considered
+ - Double sub/superscripts (eg. $x_i_j$) are considered
ambiguous and raise an exception. Use braces to disambiguate.
- - $\frac{x}{y}$ can be used for displaying fractions.
+ - $\frac{x}{y}$ can be used for displaying fractions.
- - $\sqrt[3]{x}$ can be used to display the radical symbol
+ - $\sqrt[3]{x}$ can be used to display the radical symbol
with a root number and body.
- - $\left(\frac{x}{y}\right)$ may be used to create
+ - $\left(\frac{x}{y}\right)$ may be used to create
parentheses and other delimiters that automatically
resize to the height of their contents.
- - Spacing around operators etc. is now generally more like
+ - Spacing around operators etc. is now generally more like
TeX.
- - Added support (and fonts) for boldface (\bf) and
+ - Added support (and fonts) for boldface (\bf) and
sans-serif (\sf) symbols.
- - Log-like function name shortcuts are supported. For
+ - Log-like function name shortcuts are supported. For
example, $\sin(x)$ may be used instead of ${\rm sin}(x)$
- - Limited use of kerning for the easy case (same font)
+ - Limited use of kerning for the easy case (same font)
- Behind the scenes, the pyparsing.py module used for doing
- the math parsing was updated to the latest stable version
- (1.4.6). A lot of duplicate code was refactored out of the
- Font classes.
+ Behind the scenes, the pyparsing.py module used for doing
+ the math parsing was updated to the latest stable version
+ (1.4.6). A lot of duplicate code was refactored out of the
+ Font classes.
- - MGD
+ - MGD
2007-07-19 completed numpification of most trivial cases - NN
@@ -56,11 +60,11 @@
2007-07-19 replaced the Python code in numerix/ by a minimal wrapper around
numpy that explicitly mentions all symbols that need to be
- addressed for further numpification - NN
+ addressed for further numpification - NN
-2007-07-18 make usetex respect changes to rcParams. texmanager used to
- only configure itself when it was created, now it
- reconfigures when rcParams are changed. Thank you Alexander
+2007-07-18 make usetex respect changes to rcParams. texmanager used to
+ only configure itself when it was created, now it
+ reconfigures when rcParams are changed. Thank you Alexander
Schmolck for contributing a patch - DSD
2007-07-17 added validation to setting and changing rcParams - DSD
@@ -71,7 +75,7 @@
2007-07-16 clean up some code in ticker.ScalarFormatter, use unicode to
render multiplication sign in offset ticklabel - DSD
-2007-07-16 fixed a formatting bug in ticker.ScalarFormatter's scientific
+2007-07-16 fixed a formatting bug in ticker.ScalarFormatter's scientific
notation (10^0 was being rendered as 10 in some cases) - DSD
2007-07-13 Add MPL_isfinite64() and MPL_isinf64() for testing
@@ -83,7 +87,7 @@
2007-07-13 Removed the rest of the numerix extension code detritus,
numpified axes.py, and cleaned up the imports in axes.py
- - JDH
+ - JDH
2007-07-13 Added legend.loc as configurable option that could in
future default to 'best'. - NN
@@ -552,35 +556,35 @@
2006-10-10 deactivated rcfile-configurability of markerfacecolor
and markeredgecolor. Both are now hardcoded to the special value
- 'auto' to follow the line color. Configurability at run-time
- (using function arguments) remains functional. - NN
+ 'auto' to follow the line color. Configurability at run-time
+ (using function arguments) remains functional. - NN
2006-10-07 introduced dummy argument magnification=1.0 to
FigImage.make_image to satisfy unit test figimage_demo.py
The argument is not yet handled correctly, which should only
- show up when using non-standard DPI settings in PS backend,
- introduced by patch #1562394. - NN
+ show up when using non-standard DPI settings in PS backend,
+ introduced by patch #1562394. - NN
2006-10-06 add backend-agnostic example: simple3d.py - NN
2006-09-29 fix line-breaking for SVG-inline images (purely cosmetic) - NN
2006-09-29 reworked set_linestyle and set_marker
- markeredgecolor and markerfacecolor now default to
- a special value "auto" that keeps the color in sync with
- the line color
- further, the intelligence of axes.plot is cleaned up,
- improved and simplified. Complete compatibility cannot be
- guaranteed, but the new behavior should be much more predictable
- (see patch #1104615 for details) - NN
+ markeredgecolor and markerfacecolor now default to
+ a special value "auto" that keeps the color in sync with
+ the line color
+ further, the intelligence of axes.plot is cleaned up,
+ improved and simplified. Complete compatibility cannot be
+ guaranteed, but the new behavior should be much more predictable
+ (see patch #1104615 for details) - NN
2006-09-29 changed implementation of clip-path in SVG to work around a
limitation in inkscape - NN
2006-09-29 added two options to matplotlibrc:
- svg.image_inline
- svg.image_noscale
- see patch #1533010 for details - NN
+ svg.image_inline
+ svg.image_noscale
+ see patch #1533010 for details - NN
2006-09-29 axes.py: cleaned up kwargs checking - NN
@@ -611,8 +615,8 @@
2006-09-05 Released 0.87.5 at revision 2761
2006-09-04 Added nxutils for some numeric add-on extension code --
- specifically a better/more efficient inside polygon tester
(see
- unit/inside_poly_*.py) - JDH
+ specifically a better/more efficient inside polygon tester
(see
+ unit/inside_poly_*.py) - JDH
2006-09-04 Made bitstream fonts the rc default - JDH
@@ -957,7 +961,7 @@
2006-03-20 Added contour.negative_linestyle rcParam - ADS
2006-03-20 Added _isnan extension module to test for nan with Numeric
- - ADS
+ - ADS
2006-03-17 Added Paul and Alex's support for faceting with quadmesh
in sf patch 1411223 - JDH
@@ -1304,7 +1308,7 @@
2005-11-09 added axisbelow attr for Axes to determine whether ticks and such
- are above or below the actors
+ are above or below the actors
2005-11-08 Added Nicolas' irregularly spaced image patch
@@ -1461,7 +1465,7 @@
2005-07-24 backend_gtk.py: modify print_figure() use own pixmap, fixing
problems where print_figure() overwrites the display pixmap.
- return False from all button/key etc events - to allow the event
+ return False from all button/key etc events - to allow the event
to propagate further - SC
2005-07-23 backend_gtk.py: change expose_event from using set_back_pixmap();
@@ -1483,7 +1487,7 @@
2005-07-14 Fixed a Windows related bug (#1238412) in texmanager - DSD
2005-07-11 Fixed color kwarg bug, setting color=1 or 0 caused an
- exception - DSD
+ exception - DSD
2005-07-07 Added Eric's MA set_xdata Line2D fix - JDH
@@ -1585,10 +1589,10 @@
2005-06-13 Exposed cap and join style for lines with new rc params and
line properties
- lines.dash_joinstyle : miter # miter|round|bevel
- lines.dash_capstyle : butt # butt|round|projecting
- lines.solid_joinstyle : miter # miter|round|bevel
- lines.solid_capstyle : projecting # butt|round|projecting
+ lines.dash_joinstyle : miter # miter|round|bevel
+ lines.dash_capstyle : butt # butt|round|projecting
+ lines.solid_joinstyle : miter # miter|round|bevel
+ lines.solid_capstyle : projecting # butt|round|projecting
2005-06-13 Added kwargs to Axes init
@@ -1702,9 +1706,9 @@
for the interp kwarg are
'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
- 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
- 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
- 'lanczos', 'blackman'
+ 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
+ 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
+ 'lanczos', 'blackman'
See help(imshow) for details, particularly the
interpolation, filternorm and filterrad kwargs
Modified: trunk/matplotlib/examples/pcolor_demo.py
===================================================================
--- trunk/matplotlib/examples/pcolor_demo.py 2007-07-29 08:03:12 UTC (rev
3627)
+++ trunk/matplotlib/examples/pcolor_demo.py 2007-07-30 02:04:46 UTC (rev
3628)
@@ -19,7 +19,7 @@
X,Y = meshgrid(x, y)
Z = func3(X, Y)
-pcolor(X, Y, Z, shading='flat')
+pcolor(X, Y, Z)
colorbar()
axis([-3,3,-3,3])
savefig('pcolor_demo')
Modified: trunk/matplotlib/examples/pcolor_log.py
===================================================================
--- trunk/matplotlib/examples/pcolor_log.py 2007-07-29 08:03:12 UTC (rev
3627)
+++ trunk/matplotlib/examples/pcolor_log.py 2007-07-30 02:04:46 UTC (rev
3628)
@@ -15,11 +15,11 @@
Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1*bivariate_normal(X, Y,
1.0, 1.0, 0.0, 0.0)
subplot(2,1,1)
-pcolor(X, Y, Z1, shading='flat', norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
+pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
colorbar()
subplot(2,1,2)
-pcolor(X, Y, Z1, shading='flat')
+pcolor(X, Y, Z1)
colorbar()
Modified: trunk/matplotlib/examples/pcolor_small.py
===================================================================
--- trunk/matplotlib/examples/pcolor_small.py 2007-07-29 08:03:12 UTC (rev
3627)
+++ trunk/matplotlib/examples/pcolor_small.py 2007-07-30 02:04:46 UTC (rev
3628)
@@ -2,15 +2,14 @@
from pylab import *
-#Z = arange(60)
-#Z.shape = 6,10
-#Z.shape = 10,6
-#print Z
-Z = rand(10,6)
+Z = rand(6,10)
-#c = pcolor(Z, shading='flat') # default 'faceted'
+subplot(2,1,1)
c = pcolor(Z)
-c.set_linewidth(4)
+title('default: no edges')
-#savefig('pcolor_small')
+subplot(2,1,2)
+c = pcolor(Z, edgecolors='k', linewidths=4)
+title('thick edges')
+
show()
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py 2007-07-29 08:03:12 UTC (rev
3627)
+++ trunk/matplotlib/lib/matplotlib/artist.py 2007-07-30 02:04:46 UTC (rev
3628)
@@ -55,7 +55,7 @@
Remove the artist from the figure if possible. The effect will not
be visible until the figure is redrawn, e.g., with ax.draw_idle().
Call ax.relim() to update the axes limits if desired.
-
+
Note: relim() will not see collections even if the collection
was added to axes with autolim=True.
@@ -63,10 +63,10 @@
'''
# There is no method to set the callback. Instead the parent should
set
- # the _remove_method attribute directly. This would be a protected
+ # the _remove_method attribute directly. This would be a protected
# attribute if Python supported that sort of thing. The callback
# has one parameter, which is the child to be removed.
- if self._remove_method != None:
+ if self._remove_method != None:
self._remove_method(self)
else:
raise NotImplementedError('cannot remove artist')
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2007-07-29 08:03:12 UTC (rev
3627)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2007-07-30 02:04:46 UTC (rev
3628)
@@ -3853,7 +3853,7 @@
will be plotted.
Other keyword args; the color mapping and normalization arguments will
- on be used if c is an array of floats
+ be used only if c is an array of floats
* cmap = cm.jet : a colors.Colormap instance from cm.
defaults to rc image.cmap
@@ -3876,7 +3876,12 @@
* faceted: if True, will use the default edgecolor for the
markers. If False, will set the edgecolors to be the same
- as the facecolors
+ as the facecolors.
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors=None
+ edgecolors also can be any mpl color or sequence of colors.
Optional kwargs control the PatchCollection properties:
%(PatchCollection)s
@@ -4468,7 +4473,14 @@
instance, vmin and vmax will be None
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
- drawn around each rectangle; if 'flat', edges are not drawn
+ drawn around each rectangle; if 'flat', edges are not drawn.
+ Default is 'flat', contrary to Matlab(TM).
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors='k'
+ edgecolors can also be None to specify the rcParams
+ default, or any mpl color or sequence of colors.
* alpha=1.0 : the alpha blending value
@@ -4526,7 +4538,7 @@
cmap = kwargs.pop('cmap', None)
vmin = kwargs.pop('vmin', None)
vmax = kwargs.pop('vmax', None)
- shading = kwargs.pop('shading', 'faceted')
+ shading = kwargs.pop('shading', 'flat')
if len(args)==1:
C = args[0]
@@ -4586,14 +4598,11 @@
edgecolors = (0,0,0,1),
else:
edgecolors = 'None'
+ kwargs.setdefault('edgecolors', edgecolors)
+ kwargs.setdefault('antialiaseds', (0,))
+ kwargs.setdefault('linewidths', (0.25,))
- collection = mcoll.PolyCollection(
- verts,
- edgecolors = edgecolors,
- antialiaseds = (0,),
- linewidths = (0.25,),
- **kwargs
- )
+ collection = mcoll.PolyCollection(verts, **kwargs)
collection.set_alpha(alpha)
collection.set_array(C)
@@ -4652,8 +4661,14 @@
min and max of the color array C is used.
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
- drawn around each rectangle; if 'flat', edge colors are same as
- face colors
+ drawn around each rectangle; if 'flat', edges are not drawn.
+ Default is 'flat', contrary to Matlab(TM).
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors='k'
+ More flexible specification of edgecolors, as in pcolor,
+ is not presently supported.
* alpha=1.0 : the alpha blending value
@@ -4675,7 +4690,8 @@
cmap = kwargs.pop('cmap', None)
vmin = kwargs.pop('vmin', None)
vmax = kwargs.pop('vmax', None)
- shading = kwargs.pop('shading', 'faceted')
+ shading = kwargs.pop('shading', 'flat')
+ edgecolors = kwargs.pop('edgecolors', 'None')
if len(args)==1:
C = args[0]
@@ -4703,13 +4719,13 @@
coords[:, 0] = X
coords[:, 1] = Y
- if shading == 'faceted':
+ if shading == 'faceted' or edgecolors != 'None':
showedges = 1
else:
showedges = 0
collection = mcoll.QuadMesh(
- Nx - 1, Ny - 1, coords, showedges, **kwargs)
+ Nx - 1, Ny - 1, coords, showedges) # kwargs are not used
collection.set_alpha(alpha)
collection.set_array(C)
if norm is not None: assert(isinstance(norm, mcolors.Normalize))
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2007-07-29 08:03:12 UTC
(rev 3627)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2007-07-30 02:04:46 UTC
(rev 3628)
@@ -21,16 +21,12 @@
class Collection(artist.Artist):
"""
- All properties in a collection must be sequences. The
+ All properties in a collection must be sequences or scalars;
+ if scalars, they will be converted to sequences. The
property of the ith element of the collection is the
prop[i % len(props)].
- This implies that the properties cycle if the len of props is less
- than the number of elements of the collection. A length 1
- property is shared by all the elements of the collection
-
- All color args to a collection are sequences of rgba tuples
"""
def __init__(self):
@@ -133,8 +129,8 @@
linewidths = (0,)
else:
self._edgecolors = _colors.colorConverter.to_rgba_list(edgecolors)
- self._linewidths = linewidths
- self._antialiaseds = antialiaseds
+ self._linewidths = self._get_value(linewidths)
+ self._antialiaseds = self._get_value(antialiaseds)
#self._offsets = offsets
self._offsets = offsets
self._transOffset = transOffset
@@ -221,6 +217,8 @@
ACCEPTS: float or sequence of floats
"""
self._linewidths = self._get_value(lw)
+ def set_linewidths(self, lw):
+ self.set_linewidth(lw)
def set_color(self, c):
"""
@@ -242,16 +240,23 @@
ACCEPTS: matplotlib color arg or sequence of rgba tuples
"""
self._facecolors = _colors.colorConverter.to_rgba_list(c)
+ def set_facecolors(self, c):
+ self.set_facecolor(c)
def set_edgecolor(self, c):
"""
- Set the facecolor(s) of the collection. c can be a matplotlib color
+ Set the edgecolor(s) of the collection. c can be a matplotlib color
arg (all patches have same color), or a a sequence or rgba tuples; if
it is a sequence the patches will cycle through the sequence
ACCEPTS: matplotlib color arg or sequence of rgba tuples
"""
- self._edgecolors = _colors.colorConverter.to_rgba_list(c)
+ if c == 'None':
+ self._linewidths = (0.0,)
+ else:
+ self._edgecolors = _colors.colorConverter.to_rgba_list(c)
+ def set_edgecolors(self, c):
+ self.set_edgecolor(c)
def set_alpha(self, alpha):
"""
@@ -568,7 +573,8 @@
class LineCollection(Collection, cm.ScalarMappable):
"""
- All parameters must be sequences. The property of the ith line
+ All parameters must be sequences or scalars; if scalars, they will
+ be converted to sequences. The property of the ith line
segment is the prop[i % len(props)], ie the properties cycle if
the len of props is less than the number of sements
"""
@@ -637,8 +643,8 @@
antialiaseds = (mpl.rcParams['lines.antialiased'], )
self._colors = _colors.colorConverter.to_rgba_list(colors)
- self._aa = antialiaseds
- self._lw = linewidths
+ self._aa = self._get_value(antialiaseds)
+ self._lw = self._get_value(linewidths)
self.set_linestyle(linestyle)
self._uniform_offsets = None
if offsets is not None:
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: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins