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

Method __init__

lib/matplotlib/patches.py:771–808  ·  view source on GitHub ↗

Create a shadow of the given *patch*. By default, the shadow will have the same face color as the *patch*, but darkened. The darkness can be controlled by *shade*. Parameters ---------- patch : `~matplotlib.patches.Patch` The patch to cr

(self, patch, ox, oy, *, shade=0.7, **kwargs)

Source from the content-addressed store, hash-verified

769
770 @_docstring.interpd
771 def __init__(self, patch, ox, oy, *, shade=0.7, **kwargs):
772 """
773 Create a shadow of the given *patch*.
774
775 By default, the shadow will have the same face color as the *patch*,
776 but darkened. The darkness can be controlled by *shade*.
777
778 Parameters
779 ----------
780 patch : `~matplotlib.patches.Patch`
781 The patch to create the shadow for.
782 ox, oy : float
783 The shift of the shadow in data coordinates, scaled by a factor
784 of dpi/72.
785 shade : float, default: 0.7
786 How the darkness of the shadow relates to the original color. If 1, the
787 shadow is black, if 0, the shadow has the same color as the *patch*.
788
789 .. versionadded:: 3.8
790
791 **kwargs
792 Properties of the shadow patch. Supported keys are:
793
794 %(Patch:kwdoc)s
795 """
796 super().__init__()
797 self.patch = patch
798 self._ox, self._oy = ox, oy
799 self._shadow_transform = transforms.Affine2D()
800
801 self.update_from(self.patch)
802 if not 0 <= shade <= 1:
803 raise ValueError("shade must be between 0 and 1.")
804 color = (1 - shade) * np.asarray(colors.to_rgb(self.patch.get_facecolor()))
805 self.update({'facecolor': color, 'edgecolor': color, 'alpha': 0.5,
806 # Place shadow patch directly behind the inherited patch.
807 'zorder': np.nextafter(self.patch.zorder, -np.inf),
808 **kwargs})
809
810 def _update_transform(self, renderer):
811 ox = renderer.points_to_pixels(self._ox)

Callers

nothing calls this directly

Calls 4

__init__Method · 0.45
update_fromMethod · 0.45
get_facecolorMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected