Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a87bd0

Browse files
committed
Fix rendering quality of pcolor.
svn path=/trunk/matplotlib/; revision=5671
1 parent 520ee75 commit 3a87bd0

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

CHANGELOG

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
2008-06-25 Fix rendering quality of pcolor - MGD
2+
13
=================================================================
2-
2006-02-24 Released 0.98.2 at svn r5667 - (source only for debian) JDH
4+
2008-06-24 Released 0.98.2 at svn r5667 - (source only for debian) JDH
35

4-
2006-06-24 Added "transparent" kwarg to savefig. - MGD
6+
2008-06-24 Added "transparent" kwarg to savefig. - MGD
57

6-
2006-06-24 Applied Stefan's patch to draw a sinle centered marker over
8+
2008-06-24 Applied Stefan's patch to draw a sinle centered marker over
79
a line with numpoints==1 - JDH
810

911
2008-06-23 Use splines to render circles in scatter plots - MGD

lib/matplotlib/axes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5563,8 +5563,8 @@ def pcolor(self, *args, **kwargs):
55635563
edgecolors = (0,0,0,1),
55645564
linewidths = (0.25,)
55655565
else:
5566-
edgecolors = 'None'
5567-
linewidths = (0.0,)
5566+
edgecolors = 'face'
5567+
linewidths = (1.0,)
55685568
kwargs.setdefault('edgecolors', edgecolors)
55695569
kwargs.setdefault('antialiaseds', (0,))
55705570
kwargs.setdefault('linewidths', linewidths)
@@ -5607,8 +5607,8 @@ def pcolormesh(self, *args, **kwargs):
56075607
56085608
*C* may be a masked array, but *X* and *Y* may not. Masked
56095609
array support is implemented via *cmap* and *norm*; in
5610-
contrast, *pcolor* simply does not draw quadrilaterals with
5611-
masked colors or vertices.
5610+
contrast, :func:`~matplotlib.pyplot.pcolor` simply does not
5611+
draw quadrilaterals with masked colors or vertices.
56125612
56135613
Keyword arguments:
56145614
@@ -5646,7 +5646,7 @@ def pcolormesh(self, *args, **kwargs):
56465646
*alpha*: 0 <= scalar <= 1
56475647
the alpha blending value
56485648
5649-
Return value is a :class:`matplotlib.collection.Collection`
5649+
Return value is a :class:`matplotlib.collection.QuadMesh`
56505650
object.
56515651
56525652
See :func:`~matplotlib.pyplot.pcolor` for an explanation of

lib/matplotlib/collections.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,16 @@ def draw(self, renderer):
184184
offsets = transOffset.transform_non_affine(offsets)
185185
transOffset = transOffset.get_affine()
186186

187+
if self._edgecolors == 'face':
188+
edgecolors = self._facecolors
189+
else:
190+
edgecolors = self._edgecolors
191+
187192
renderer.draw_path_collection(
188193
transform.frozen(), self.clipbox, clippath, clippath_trans,
189194
paths, self.get_transforms(),
190195
offsets, transOffset,
191-
self._facecolors, self._edgecolors, self._linewidths,
196+
self._facecolors, edgecolors, self._linewidths,
192197
self._linestyles, self._antialiaseds)
193198
renderer.close_group(self.__class__.__name__)
194199

@@ -318,12 +323,18 @@ def set_edgecolor(self, c):
318323
Set the edgecolor(s) of the collection. *c* can be a
319324
matplotlib color arg (all patches have same color), or a
320325
sequence or rgba tuples; if it is a sequence the patches will
321-
cycle through the sequence
326+
cycle through the sequence.
327+
328+
If *c* is 'face', the edge color will always be the same as
329+
the face color.
322330
323331
ACCEPTS: matplotlib color arg or sequence of rgba tuples
324332
"""
325-
if c is None: c = mpl.rcParams['patch.edgecolor']
326-
self._edgecolors = _colors.colorConverter.to_rgba_array(c, self._alpha)
333+
if c == 'face':
334+
self._edgecolors = 'face'
335+
else:
336+
if c is None: c = mpl.rcParams['patch.edgecolor']
337+
self._edgecolors = _colors.colorConverter.to_rgba_array(c, self._alpha)
327338

328339
set_edgecolors = set_edgecolor
329340

0 commit comments

Comments
 (0)