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

Method draw_path

lib/matplotlib/patheffects.py:319–340  ·  view source on GitHub ↗

Overrides the standard draw_path to add the shadow offset and necessary color changes for the shadow.

(self, renderer, gc, tpath, affine, rgbFace)

Source from the content-addressed store, hash-verified

317 self._gc = kwargs
318
319 def draw_path(self, renderer, gc, tpath, affine, rgbFace):
320 """
321 Overrides the standard draw_path to add the shadow offset and
322 necessary color changes for the shadow.
323 """
324 gc0 = renderer.new_gc() # Don't modify gc, but a copy!
325 gc0.copy_properties(gc)
326
327 if self._shadow_color is None:
328 r, g, b = (gc0.get_rgb() or (1., 1., 1.))[:3]
329 # Scale the colors by a factor to improve the shadow effect.
330 shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
331 else:
332 shadow_rgbFace = self._shadow_color
333
334 gc0.set_foreground(mcolors.to_rgba(shadow_rgbFace), isRGBA=True)
335 gc0.set_alpha(self._alpha)
336
337 gc0 = self._update_gc(gc0, self._gc)
338 renderer.draw_path(
339 gc0, tpath, affine + self._offset_transform(renderer))
340 gc0.restore()
341
342
343class PathPatchEffect(AbstractPathEffect):

Callers

nothing calls this directly

Calls 10

_update_gcMethod · 0.80
_offset_transformMethod · 0.80
new_gcMethod · 0.45
copy_propertiesMethod · 0.45
get_rgbMethod · 0.45
set_foregroundMethod · 0.45
to_rgbaMethod · 0.45
set_alphaMethod · 0.45
draw_pathMethod · 0.45
restoreMethod · 0.45

Tested by

no test coverage detected