Skip to content

Commit baa352c

Browse files
committed
Add get/set color methods for some 3d collections
* closes matplotlib#3370
1 parent 63cc594 commit baa352c

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

‎lib/mpl_toolkits/mplot3d/art3d.py‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,17 @@ def __init__(self, *args, **kwargs):
323323
PatchCollection.__init__(self, *args, **kwargs)
324324
self.set_3d_properties(zs, zdir)
325325

326+
def set_facecolor(self, c):
327+
PatchCollection.set_facecolor(self, c)
328+
self._facecolor3d = self.get_facecolor()
329+
set_facecolor.__doc__ = PatchCollection.set_facecolor.__doc__
330+
set_facecolors = set_facecolor
331+
332+
def set_edgecolor(self, c):
333+
PatchCollection.set_edgecolor(self, c)
334+
self._edgecolor3d = self.get_edgecolor()
335+
set_edgecolor.__doc__ = PatchCollection.set_edgecolor.__doc__
336+
set_edgecolors = set_edgecolor
326337

327338
def set_sort_zpos(self,val):
328339
'''Set the position to use for z-sorting.'''
@@ -349,12 +360,12 @@ def do_3d_projection(self, renderer):
349360
fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else
350361
self._facecolor3d)
351362
fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha)
352-
self.set_facecolors(fcs)
363+
PatchCollection.set_facecolors(self, fcs)
353364

354365
ecs = (zalpha(self._edgecolor3d, vzs) if self._depthshade else
355366
self._edgecolor3d)
356367
ecs = mcolors.colorConverter.to_rgba_array(ecs, self._alpha)
357-
self.set_edgecolors(ecs)
368+
PatchCollection.set_edgecolors(self, ecs)
358369
PatchCollection.set_offsets(self, list(zip(vxs, vys)))
359370

360371
if vzs.size > 0 :
@@ -408,19 +419,31 @@ def set_3d_properties(self, zs, zdir):
408419
self._facecolor3d = self.get_facecolor()
409420
self._edgecolor3d = self.get_edgecolor()
410421

422+
def set_facecolor(self, c):
423+
PathCollection.set_facecolor(self, c)
424+
self._facecolor3d = self.get_facecolor()
425+
set_facecolor.__doc__ = PathCollection.set_facecolor.__doc__
426+
set_facecolors = set_facecolor
427+
428+
def set_edgecolor(self, c):
429+
PathCollection.set_edgecolor(self, c)
430+
self._edgecolor3d = self.get_edgecolor()
431+
set_edgecolor.__doc__ = PathCollection.set_edgecolor.__doc__
432+
set_edgecolors = set_edgecolor
433+
411434
def do_3d_projection(self, renderer):
412435
xs, ys, zs = self._offsets3d
413436
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
414437

415438
fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else
416439
self._facecolor3d)
417440
fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha)
418-
self.set_facecolors(fcs)
441+
PathCollection.set_facecolors(self, fcs)
419442

420443
ecs = (zalpha(self._edgecolor3d, vzs) if self._depthshade else
421444
self._edgecolor3d)
422445
ecs = mcolors.colorConverter.to_rgba_array(ecs, self._alpha)
423-
self.set_edgecolors(ecs)
446+
PathCollection.set_edgecolors(self, ecs)
424447
PathCollection.set_offsets(self, list(zip(vxs, vys)))
425448

426449
if vzs.size > 0 :

0 commit comments

Comments
 (0)