MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / do_3d_projection

Method do_3d_projection

lib/mpl_toolkits/mplot3d/art3d.py:1084–1127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1082 self.stale = True
1083
1084 def do_3d_projection(self):
1085 mask = False
1086 for xyz in self._offsets3d:
1087 if np.ma.isMA(xyz):
1088 mask = mask | xyz.mask
1089 mask = mask | _scale_invalid_mask(*self._offsets3d, self.axes)
1090 if self._axlim_clip:
1091 mask = mask | _viewlim_mask(*self._offsets3d, self.axes)
1092 if np.any(mask):
1093 mask = np.broadcast_to(mask,
1094 (len(self._offsets3d), *self._offsets3d[0].shape))
1095 xyzs = np.ma.array(self._offsets3d, mask=mask)
1096 else:
1097 xyzs = self._offsets3d
1098 vxs, vys, vzs, vis = proj3d._scale_proj_transform_clip(*xyzs, self.axes)
1099 self._data_scale = _get_data_scale(vxs, vys, vzs)
1100 # Sort the points based on z coordinates
1101 # Performance optimization: Create a sorted index array and reorder
1102 # points and point properties according to the index array
1103 z_markers_idx = self._z_markers_idx = np.ma.argsort(vzs)[::-1]
1104 self._vzs = vzs
1105
1106 # we have to special case the sizes because of code in collections.py
1107 # as the draw method does
1108 # self.set_sizes(self._sizes, self.figure.dpi)
1109 # so we cannot rely on doing the sorting on the way out via get_*
1110
1111 if len(self._sizes3d) > 1:
1112 self._sizes = self._sizes3d[z_markers_idx]
1113
1114 if len(self._linewidths3d) > 1:
1115 self._linewidths = self._linewidths3d[z_markers_idx]
1116
1117 PathCollection.set_offsets(self, np.ma.column_stack((vxs, vys)))
1118
1119 # Re-order items
1120 vzs = vzs[z_markers_idx]
1121 vxs = vxs[z_markers_idx]
1122 vys = vys[z_markers_idx]
1123
1124 # Store ordered offset for drawing purpose
1125 self._offset_zordered = np.ma.column_stack((vxs, vys))
1126
1127 return np.min(vzs) if vzs.size else np.nan
1128
1129 @contextmanager
1130 def _use_zordered_offset(self):

Callers

nothing calls this directly

Calls 5

_scale_invalid_maskFunction · 0.85
_viewlim_maskFunction · 0.85
_get_data_scaleFunction · 0.85
minMethod · 0.80
set_offsetsMethod · 0.45

Tested by

no test coverage detected