From 1c3daacd6f2cd5f192a0105baeaabdbd42476694 Mon Sep 17 00:00:00 2001 From: Benjamin Root Date: Mon, 9 Feb 2015 15:36:32 -0500 Subject: [PATCH] Add get/set color methods for some 3d collections * closes #3370 --- lib/mpl_toolkits/mplot3d/art3d.py | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 027d6a07eb76..036026c2d939 100755 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -363,6 +363,18 @@ def __init__(self, *args, **kwargs): PatchCollection.__init__(self, *args, **kwargs) self.set_3d_properties(zs, zdir) + def set_facecolor(self, c): + PatchCollection.set_facecolor(self, c) + self._facecolor3d = self.get_facecolor() + set_facecolor.__doc__ = PatchCollection.set_facecolor.__doc__ + set_facecolors = set_facecolor + + def set_edgecolor(self, c): + PatchCollection.set_edgecolor(self, c) + self._edgecolor3d = self.get_edgecolor() + set_edgecolor.__doc__ = PatchCollection.set_edgecolor.__doc__ + set_edgecolors = set_edgecolor + def set_sort_zpos(self, val): '''Set the position to use for z-sorting.''' self._sort_zpos = val @@ -390,12 +402,12 @@ def do_3d_projection(self, renderer): fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else self._facecolor3d) fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha) - self.set_facecolors(fcs) + PatchCollection.set_facecolors(self, fcs) ecs = (zalpha(self._edgecolor3d, vzs) if self._depthshade else self._edgecolor3d) ecs = mcolors.colorConverter.to_rgba_array(ecs, self._alpha) - self.set_edgecolors(ecs) + PatchCollection.set_edgecolors(self, ecs) PatchCollection.set_offsets(self, list(zip(vxs, vys))) if vzs.size > 0: @@ -451,6 +463,18 @@ def set_3d_properties(self, zs, zdir): self._edgecolor3d = self.get_edgecolor() self.stale = True + def set_facecolor(self, c): + PathCollection.set_facecolor(self, c) + self._facecolor3d = self.get_facecolor() + set_facecolor.__doc__ = PathCollection.set_facecolor.__doc__ + set_facecolors = set_facecolor + + def set_edgecolor(self, c): + PathCollection.set_edgecolor(self, c) + self._edgecolor3d = self.get_edgecolor() + set_edgecolor.__doc__ = PathCollection.set_edgecolor.__doc__ + set_edgecolors = set_edgecolor + def do_3d_projection(self, renderer): xs, ys, zs = self._offsets3d vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M) @@ -458,12 +482,12 @@ def do_3d_projection(self, renderer): fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else self._facecolor3d) fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha) - self.set_facecolors(fcs) + PathCollection.set_facecolors(self, fcs) ecs = (zalpha(self._edgecolor3d, vzs) if self._depthshade else self._edgecolor3d) ecs = mcolors.colorConverter.to_rgba_array(ecs, self._alpha) - self.set_edgecolors(ecs) + PathCollection.set_edgecolors(self, ecs) PathCollection.set_offsets(self, list(zip(vxs, vys))) if vzs.size > 0 :