Skip to content

Commit eebbeb4

Browse files
committed
In collections draw methods, use get_facecolor and get_edgecolor.
The logic for edgecolors='face' is moved into get_edgecolor so that it will return the color(s) that will actually be used. Using the getters means that a derived class can override them to add more logic to the choice of colors. svn path=/trunk/matplotlib/; revision=5795
1 parent 6a2f896 commit eebbeb4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/matplotlib/collections.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,12 @@ 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
191187

192188
renderer.draw_path_collection(
193189
transform.frozen(), self.clipbox, clippath, clippath_trans,
194190
paths, self.get_transforms(),
195191
offsets, transOffset,
196-
self._facecolors, edgecolors, self._linewidths,
192+
self.get_facecolor(), self.get_edgecolor(), self._linewidths,
197193
self._linestyles, self._antialiaseds)
198194
renderer.close_group(self.__class__.__name__)
199195

@@ -315,7 +311,10 @@ def get_facecolor(self):
315311
get_facecolors = get_facecolor
316312

317313
def get_edgecolor(self):
318-
return self._edgecolors
314+
if self._edgecolors == 'face':
315+
return self.get_facecolors()
316+
else:
317+
return self._edgecolors
319318
get_edgecolors = get_edgecolor
320319

321320
def set_edgecolor(self, c):
@@ -534,7 +533,7 @@ def draw(self, renderer):
534533
renderer.draw_quad_mesh(
535534
transform.frozen(), self.clipbox, clippath, clippath_trans,
536535
self._meshWidth, self._meshHeight, coordinates,
537-
offsets, transOffset, self._facecolors, self._antialiased,
536+
offsets, transOffset, self.get_facecolor(), self._antialiased,
538537
self._showedges)
539538
renderer.close_group(self.__class__.__name__)
540539

0 commit comments

Comments
 (0)