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

Method draw_path

lib/matplotlib/patheffects.py:257–280  ·  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

255 self._gc = kwargs
256
257 def draw_path(self, renderer, gc, tpath, affine, rgbFace):
258 """
259 Overrides the standard draw_path to add the shadow offset and
260 necessary color changes for the shadow.
261 """
262 gc0 = renderer.new_gc() # Don't modify gc, but a copy!
263 gc0.copy_properties(gc)
264
265 if self._shadow_rgbFace is None:
266 r, g, b = (rgbFace or (1., 1., 1.))[:3]
267 # Scale the colors by a factor to improve the shadow effect.
268 shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
269 else:
270 shadow_rgbFace = self._shadow_rgbFace
271
272 gc0.set_foreground(mcolors.to_rgba("none"), isRGBA=True)
273 gc0.set_alpha(self._alpha)
274 gc0.set_linewidth(0)
275
276 gc0 = self._update_gc(gc0, self._gc)
277 renderer.draw_path(
278 gc0, tpath, affine + self._offset_transform(renderer),
279 shadow_rgbFace)
280 gc0.restore()
281
282
283withSimplePatchShadow = _subclass_with_normal(effect_class=SimplePatchShadow)

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected