def test_art3d_deprecated(): with pytest.warns(MatplotlibDeprecationWarning): art3d.norm_angle(0.0) with pytest.warns(MatplotlibDeprecationWarning): art3d.norm_text_angle(0.0) path = mpath.Path(np.empty((0, 2))) with pytest.warns(MatplotlibDeprecationWarning): art3d.path_to_3d_segment(path) with pytest.warns(MatplotlibDeprecationWarning): art3d.paths_to_3d_segments([path]) with pytest.warns(MatplotlibDeprecationWarning): art3d.path_to_3d_segment_with_codes(path) with pytest.warns(MatplotlibDeprecationWarning): art3d.paths_to_3d_segments_with_codes([path]) with pytest.warns(MatplotlibDeprecationWarning): art3d.get_colors([], 1) with pytest.warns(MatplotlibDeprecationWarning): art3d.zalpha([], [])
def do_3d_projection(self, renderer): from mpl_toolkits.mplot3d import proj3d from mpl_toolkits.mplot3d.art3d import zalpha from matplotlib import colors as mcolors # transform and sort in z direction v = np.array( proj3d.proj_transform_clip(*self._offsets3d, M=renderer.M)[:3]) idx = v[2].argsort()[::-1] vzs = v[2, idx] self.set_offsets(v[:2, idx].transpose()) super().set_array(self._A0[idx]) fcs = zalpha(self._facecolor3d, vzs) if self._depthshade else self._facecolor3d fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha) self.set_facecolors(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) return min(vzs) if vzs.size > 0 else np.nan
def do_3d_projection(self, renderer): from mpl_toolkits.mplot3d import proj3d from mpl_toolkits.mplot3d.art3d import zalpha from matplotlib import colors as mcolors # transform and sort in z direction v = np.array(proj3d.proj_transform_clip(*self._offsets3d, M=renderer.M)[:3]) idx = v[2].argsort()[::-1] vzs = v[2, idx] self.set_offsets(v[:2, idx].transpose()) super().set_array(self._A0[idx]) fcs = zalpha(self._facecolor3d, vzs) if self._depthshade else self._facecolor3d fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha) self.set_facecolors(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) return min(vzs) if vzs.size > 0 else np.nan