MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / draw

Method draw

site-packages/matplotlib/collections.py:255–336  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

253
254 @artist.allow_rasterization
255 def draw(self, renderer):
256 if not self.get_visible():
257 return
258 renderer.open_group(self.__class__.__name__, self.get_gid())
259
260 self.update_scalarmappable()
261
262 transform, transOffset, offsets, paths = self._prepare_points()
263
264 gc = renderer.new_gc()
265 self._set_gc_clip(gc)
266 gc.set_snap(self.get_snap())
267
268 if self._hatch:
269 gc.set_hatch(self._hatch)
270 try:
271 gc.set_hatch_color(self._hatch_color)
272 except AttributeError:
273 # if we end up with a GC that does not have this method
274 warnings.warn("Your backend does not support setting the "
275 "hatch color.")
276
277 if self.get_sketch_params() is not None:
278 gc.set_sketch_params(*self.get_sketch_params())
279
280 if self.get_path_effects():
281 from matplotlib.patheffects import PathEffectRenderer
282 renderer = PathEffectRenderer(self.get_path_effects(), renderer)
283
284 # If the collection is made up of a single shape/color/stroke,
285 # it can be rendered once and blitted multiple times, using
286 # `draw_markers` rather than `draw_path_collection`. This is
287 # *much* faster for Agg, and results in smaller file sizes in
288 # PDF/SVG/PS.
289
290 trans = self.get_transforms()
291 facecolors = self.get_facecolor()
292 edgecolors = self.get_edgecolor()
293 do_single_path_optimization = False
294 if (len(paths) == 1 and len(trans) <= 1 and
295 len(facecolors) == 1 and len(edgecolors) == 1 and
296 len(self._linewidths) == 1 and
297 self._linestyles == [(None, None)] and
298 len(self._antialiaseds) == 1 and len(self._urls) == 1 and
299 self.get_hatch() is None):
300 if len(trans):
301 combined_transform = (transforms.Affine2D(trans[0]) +
302 transform)
303 else:
304 combined_transform = transform
305 extents = paths[0].get_extents(combined_transform)
306 width, height = renderer.get_canvas_width_height()
307 if extents.width < width and extents.height < height:
308 do_single_path_optimization = True
309
310 if self._joinstyle:
311 gc.set_joinstyle(self._joinstyle)
312

Callers

nothing calls this directly

Calls 15

update_scalarmappableMethod · 0.95
_prepare_pointsMethod · 0.95
new_gcMethod · 0.95
get_transformsMethod · 0.95
get_facecolorMethod · 0.95
get_edgecolorMethod · 0.95
get_hatchMethod · 0.95
draw_markersMethod · 0.95
draw_path_collectionMethod · 0.95
PathEffectRendererClass · 0.90
get_visibleMethod · 0.80
_set_gc_clipMethod · 0.80

Tested by

no test coverage detected