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

Function _draw_rasterized

lib/matplotlib/axes/_base.py:5059–5119  ·  view source on GitHub ↗

A helper function for rasterizing the list of artists. The bookkeeping to track if we are or are not in rasterizing mode with the mixed-mode backends is relatively complicated and is now handled in the matplotlib.artist.allow_rasterization decorator. This helper defines the ab

(figure, artists, renderer)

Source from the content-addressed store, hash-verified

5057
5058
5059def _draw_rasterized(figure, artists, renderer):
5060 """
5061 A helper function for rasterizing the list of artists.
5062
5063 The bookkeeping to track if we are or are not in rasterizing mode
5064 with the mixed-mode backends is relatively complicated and is now
5065 handled in the matplotlib.artist.allow_rasterization decorator.
5066
5067 This helper defines the absolute minimum methods and attributes on a
5068 shim class to be compatible with that decorator and then uses it to
5069 rasterize the list of artists.
5070
5071 This is maybe too-clever, but allows us to reuse the same code that is
5072 used on normal artists to participate in the "are we rasterizing"
5073 accounting.
5074
5075 Please do not use this outside of the "rasterize below a given zorder"
5076 functionality of Axes.
5077
5078 Parameters
5079 ----------
5080 figure : matplotlib.figure.Figure
5081 The figure all of the artists belong to (not checked). We need this
5082 because we can at the figure level suppress composition and insert each
5083 rasterized artist as its own image.
5084
5085 artists : List[matplotlib.artist.Artist]
5086 The list of Artists to be rasterized. These are assumed to all
5087 be in the same Figure.
5088
5089 renderer : matplotlib.backendbases.RendererBase
5090 The currently active renderer
5091
5092 Returns
5093 -------
5094 None
5095
5096 """
5097 class _MinimalArtist:
5098 def get_rasterized(self):
5099 return True
5100
5101 def get_agg_filter(self):
5102 return None
5103
5104 def __init__(self, figure, artists):
5105 self.figure = figure
5106 self.artists = artists
5107
5108 def get_figure(self, root=False):
5109 if root:
5110 return self.figure.get_figure(root=True)
5111 else:
5112 return self.figure
5113
5114 @martist.allow_rasterization
5115 def draw(self, renderer):
5116 for a in self.artists:

Callers 1

drawMethod · 0.85

Calls 2

_MinimalArtistClass · 0.85
drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…