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

Method draw

lib/matplotlib/axes/_base.py:3286–3354  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

3284 # Drawing
3285 @martist.allow_rasterization
3286 def draw(self, renderer):
3287 # docstring inherited
3288 if renderer is None:
3289 raise RuntimeError('No renderer defined')
3290 if not self.get_visible():
3291 return
3292 self._unstale_viewLim()
3293
3294 renderer.open_group('axes', gid=self.get_gid())
3295
3296 # prevent triggering call backs during the draw process
3297 self._stale = True
3298
3299 # loop over self and child Axes...
3300 locator = self.get_axes_locator()
3301 self.apply_aspect(locator(self, renderer) if locator else None)
3302
3303 artists = self.get_children()
3304 artists.remove(self.patch)
3305
3306 # the frame draws the edges around the Axes patch -- we
3307 # decouple these so the patch can be in the background and the
3308 # frame in the foreground. Do this before drawing the axis
3309 # objects so that the spine has the opportunity to update them.
3310 if not (self.axison and self._frameon):
3311 for spine in self.spines.values():
3312 artists.remove(spine)
3313
3314 self._update_title_position(renderer)
3315
3316 if not self.axison:
3317 for _axis in self._axis_map.values():
3318 artists.remove(_axis)
3319
3320 if not self.get_figure(root=True).canvas.is_saving():
3321 artists = [
3322 a for a in artists
3323 if not a.get_animated()]
3324 artists = sorted(artists, key=attrgetter('zorder'))
3325
3326 # rasterize artists with negative zorder
3327 # if the minimum zorder is negative, start rasterization
3328 rasterization_zorder = self._rasterization_zorder
3329
3330 if (rasterization_zorder is not None and
3331 artists and artists[0].zorder < rasterization_zorder):
3332 split_index = np.searchsorted(
3333 [art.zorder for art in artists],
3334 rasterization_zorder, side='right'
3335 )
3336 artists_rasterized = artists[:split_index]
3337 artists = artists[split_index:]
3338 else:
3339 artists_rasterized = []
3340
3341 if self.axison and self._frameon:
3342 if artists_rasterized:
3343 artists_rasterized = [self.patch] + artists_rasterized

Callers 4

redraw_in_frameMethod · 0.95
draw_artistMethod · 0.45
drawMethod · 0.45
_draw_rasterizedFunction · 0.45

Calls 15

_unstale_viewLimMethod · 0.95
get_axes_locatorMethod · 0.95
apply_aspectMethod · 0.95
get_childrenMethod · 0.95
_draw_rasterizedFunction · 0.85
valuesMethod · 0.80
is_savingMethod · 0.80
get_animatedMethod · 0.80
get_visibleMethod · 0.45
open_groupMethod · 0.45
get_gidMethod · 0.45

Tested by

no test coverage detected