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

Method draw

lib/mpl_toolkits/mplot3d/art3d.py:217–237  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

215
216 @artist.allow_rasterization
217 def draw(self, renderer):
218 mask = _scale_invalid_mask(self._x, self._y, self._z, self.axes)
219 if self._axlim_clip:
220 mask |= _viewlim_mask(self._x, self._y, self._z, self.axes)
221 if np.any(mask):
222 pos3d = np.ma.array([self._x, self._y, self._z],
223 mask=mask, dtype=float).filled(np.nan)
224 else:
225 pos3d = np.array([self._x, self._y, self._z], dtype=float)
226
227 dir_end = pos3d + self._dir_vec
228 points = np.asarray([pos3d, dir_end])
229 proj = proj3d._scale_proj_transform(
230 points[:, 0], points[:, 1], points[:, 2], self.axes)
231 dx = proj[0][1] - proj[0][0]
232 dy = proj[1][1] - proj[1][0]
233 angle = math.degrees(math.atan2(dy, dx))
234 with cbook._setattr_cm(self, _x=proj[0][0], _y=proj[1][0],
235 _rotation=_norm_text_angle(angle)):
236 mtext.Text.draw(self, renderer)
237 self.stale = False
238
239 def get_tightbbox(self, renderer=None):
240 # Overwriting the 2d Text behavior which is not valid for 3d.

Callers 2

drawMethod · 0.45
drawMethod · 0.45

Calls 3

_scale_invalid_maskFunction · 0.85
_viewlim_maskFunction · 0.85
_norm_text_angleFunction · 0.85

Tested by

no test coverage detected