Skip to content

Commit b27e0b5

Browse files
committed
Let pcolor antialiasing default be controlled by patch.antialiasing.
See ticket 3017725. In most cases antialiasing is better than, or nearly as good as, non-antialiasing. A note about artifacts is now in the docstring. svn path=/trunk/matplotlib/; revision=8452
1 parent 3220c33 commit b27e0b5

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

lib/matplotlib/axes.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6740,16 +6740,16 @@ def pcolor(self, *args, **kwargs):
67406740
*shading*: [ 'flat' | 'faceted' ]
67416741
If 'faceted', a black grid is drawn around each rectangle; if
67426742
'flat', edges are not drawn. Default is 'flat', contrary to
6743-
Matlab(TM).
6743+
Matlab.
67446744
67456745
This kwarg is deprecated; please use 'edgecolors' instead:
6746-
* shading='flat' -- edgecolors='None'
6746+
* shading='flat' -- edgecolors='none'
67476747
* shading='faceted -- edgecolors='k'
67486748
6749-
*edgecolors*: [ None | 'None' | color | color sequence]
6749+
*edgecolors*: [ None | 'none' | color | color sequence]
67506750
If *None*, the rc setting is used by default.
67516751
6752-
If 'None', edges will not be visible.
6752+
If 'none', edges will not be visible.
67536753
67546754
An mpl color or sequence of colors will set the edge color
67556755
@@ -6805,6 +6805,16 @@ def pcolor(self, *args, **kwargs):
68056805
:class:`~matplotlib.collection.PolyCollection` properties:
68066806
68076807
%(PolyCollection)s
6808+
6809+
Note: the default *antialiaseds* is taken from
6810+
rcParams['patch.antialiased'], which defaults to *True*.
6811+
In some cases, particularly if *alpha* is 1,
6812+
you may be able to reduce rendering artifacts (light or
6813+
dark patch boundaries) by setting it to *False*. An
6814+
alternative it to set *edgecolors* to 'face'. Unfortunately,
6815+
there seems to be no single combination of parameters that
6816+
eliminates artifacts under all conditions.
6817+
68086818
"""
68096819

68106820
if not self._hold: self.cla()
@@ -6850,19 +6860,22 @@ def pcolor(self, *args, **kwargs):
68506860
axis=1)
68516861
verts = xy.reshape((npoly, 5, 2))
68526862

6853-
#verts = zip(zip(X1,Y1),zip(X2,Y2),zip(X3,Y3),zip(X4,Y4))
6854-
68556863
C = compress(ravelmask, ma.filled(C[0:Ny-1,0:Nx-1]).ravel())
68566864

6857-
68586865
if shading == 'faceted':
6859-
edgecolors = (0,0,0,1),
6860-
linewidths = (0.25,)
6866+
edgecolors = 'k',
68616867
else:
6862-
edgecolors = 'face'
6863-
linewidths = (1.0,)
6868+
edgecolors = 'none'
6869+
linewidths = (0.25,)
6870+
# Not sure if we want to have the following, or just trap
6871+
# invalid kwargs and raise an exception.
6872+
if 'edgecolor' in kwargs:
6873+
kwargs['edgecolors'] = kwargs.pop('edgecolor')
6874+
if 'linewidth' in kwargs:
6875+
kwargs['linewidths'] = kwargs.pop('linewidth')
6876+
if 'antialiased' in kwargs:
6877+
kwargs['antialiaseds'] = kwargs.pop('antialiased')
68646878
kwargs.setdefault('edgecolors', edgecolors)
6865-
kwargs.setdefault('antialiaseds', (0,))
68666879
kwargs.setdefault('linewidths', linewidths)
68676880

68686881
collection = mcoll.PolyCollection(verts, **kwargs)

0 commit comments

Comments
 (0)