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

Method draw_path_collection

lib/matplotlib/backend_bases.py:210–259  ·  view source on GitHub ↗

Draw a collection of *paths*. Each path is first transformed by the corresponding entry in *all_transforms* (a list of (3, 3) matrices) and then by *master_transform*. They are then translated by the corresponding entry in *offsets*, which has been first tr

(self, gc, master_transform, paths, all_transforms,
                             offsets, offset_trans, facecolors, edgecolors,
                             linewidths, linestyles, antialiaseds, urls,
                             offset_position, *, hatchcolors=None)

Source from the content-addressed store, hash-verified

208 rgbFace)
209
210 def draw_path_collection(self, gc, master_transform, paths, all_transforms,
211 offsets, offset_trans, facecolors, edgecolors,
212 linewidths, linestyles, antialiaseds, urls,
213 offset_position, *, hatchcolors=None):
214 """
215 Draw a collection of *paths*.
216
217 Each path is first transformed by the corresponding entry
218 in *all_transforms* (a list of (3, 3) matrices) and then by
219 *master_transform*. They are then translated by the corresponding
220 entry in *offsets*, which has been first transformed by *offset_trans*.
221
222 *facecolors*, *edgecolors*, *linewidths*, *linestyles*, *antialiased*
223 and *hatchcolors* are lists that set the corresponding properties.
224
225 .. versionadded:: 3.11
226 Allow *hatchcolors* to be specified.
227
228 *offset_position* is unused now, but the argument is kept for
229 backwards compatibility.
230
231 The base (fallback) implementation makes multiple calls to `draw_path`.
232 Backends may want to override this in order to render each set of
233 path data only once, and then reference that path multiple times with
234 the different offsets, colors, styles etc. The generator methods
235 `!_iter_collection_raw_paths` and `!_iter_collection` are provided to
236 help with (and standardize) the implementation across backends. It
237 is highly recommended to use those generators, so that changes to the
238 behavior of `draw_path_collection` can be made globally.
239 """
240 path_ids = self._iter_collection_raw_paths(master_transform,
241 paths, all_transforms)
242
243 if hatchcolors is None:
244 hatchcolors = []
245
246 for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
247 gc, list(path_ids), offsets, offset_trans,
248 facecolors, edgecolors, linewidths, linestyles,
249 antialiaseds, urls, offset_position, hatchcolors=hatchcolors):
250 path, transform = path_id
251 # Only apply another translation if we have an offset, else we
252 # reuse the initial transform.
253 if xo != 0 or yo != 0:
254 # The transformation can be used by multiple paths. Since
255 # translate is a inplace operation, we need to copy the
256 # transformation by .frozen() before applying the translation.
257 transform = transform.frozen()
258 transform.translate(xo, yo)
259 self.draw_path(gc0, path, transform, rgbFace)
260
261 def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
262 coordinates, offsets, offsetTrans, facecolors,

Callers 1

draw_quad_meshMethod · 0.95

Calls 5

_iter_collectionMethod · 0.95
draw_pathMethod · 0.95
translateMethod · 0.80
frozenMethod · 0.45

Tested by

no test coverage detected