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

Method draw

lib/mpl_toolkits/mplot3d/axes3d.py:456–513  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

454
455 @martist.allow_rasterization
456 def draw(self, renderer):
457 if not self.get_visible():
458 return
459 self._unstale_viewLim()
460
461 # draw the background patch
462 self.patch.draw(renderer)
463 self._frameon = False
464
465 # first, set the aspect
466 # this is duplicated from `axes._base._AxesBase.draw`
467 # but must be called before any of the artist are drawn as
468 # it adjusts the view limits and the size of the bounding box
469 # of the Axes
470 locator = self.get_axes_locator()
471 self.apply_aspect(locator(self, renderer) if locator else None)
472
473 # add the projection matrix to the renderer
474 self.M = self.get_proj()
475 self.invM = np.linalg.inv(self.M)
476
477 collections_and_patches = (
478 artist for artist in self._children
479 if isinstance(artist, (mcoll.Collection, mpatches.Patch))
480 and artist.get_visible())
481 if self.computed_zorder:
482 # Calculate projection of collections and patches and zorder
483 # them. Make sure they are drawn above the grids.
484 zorder_offset = max(axis.get_zorder()
485 for axis in self._axis_map.values()) + 1
486 collection_zorder = patch_zorder = zorder_offset
487
488 for artist in sorted(collections_and_patches,
489 key=lambda artist: artist.do_3d_projection(),
490 reverse=True):
491 if isinstance(artist, mcoll.Collection):
492 artist.zorder = collection_zorder
493 collection_zorder += 1
494 elif isinstance(artist, mpatches.Patch):
495 artist.zorder = patch_zorder
496 patch_zorder += 1
497 else:
498 for artist in collections_and_patches:
499 artist.do_3d_projection()
500
501 if self._axis3don:
502 # Draw panes first
503 for axis in self._axis_map.values():
504 axis.draw_pane(renderer)
505 # Then gridlines
506 for axis in self._axis_map.values():
507 axis.draw_grid(renderer)
508 # Then axes, labels, text, and ticks
509 for axis in self._axis_map.values():
510 axis.draw(renderer)
511
512 # Then rest
513 super().draw(renderer)

Callers

nothing calls this directly

Calls 10

apply_aspectMethod · 0.95
get_projMethod · 0.95
_unstale_viewLimMethod · 0.80
get_zorderMethod · 0.80
valuesMethod · 0.80
draw_paneMethod · 0.80
draw_gridMethod · 0.80
get_visibleMethod · 0.45
get_axes_locatorMethod · 0.45
do_3d_projectionMethod · 0.45

Tested by

no test coverage detected