Skip to content

Commit 6e7dd77

Browse files
authored
Merge pull request #17656 from QuLogic/pie-shadow
FIX: default colouring of Shadows
2 parents 9c9c21b + 3497b07 commit 6e7dd77

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,8 +3076,7 @@ def get_next_color():
30763076
if shadow:
30773077
# Make sure to add a shadow after the call to add_patch so the
30783078
# figure and transform props will be set.
3079-
shad = mpatches.Shadow(w, -0.02, -0.02)
3080-
shad.set(zorder=0.9 * w.get_zorder(), label='_nolegend_')
3079+
shad = mpatches.Shadow(w, -0.02, -0.02, label='_nolegend_')
30813080
self.add_patch(shad)
30823081

30833082
if labeldistance is not None:

lib/matplotlib/patches.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,14 @@ def __init__(self, patch, ox, oy, props=None, **kwargs):
645645
self.patch = patch
646646
# Note: when removing props, we can directly pass kwargs to _update()
647647
# and remove self._props
648-
self._props = {**(props if props is not None else {}), **kwargs}
648+
if props is None:
649+
color = .3 * np.asarray(colors.to_rgb(self.patch.get_facecolor()))
650+
props = {
651+
'facecolor': color,
652+
'edgecolor': color,
653+
'alpha': 0.5,
654+
}
655+
self._props = {**props, **kwargs}
649656
self._ox, self._oy = ox, oy
650657
self._shadow_transform = transforms.Affine2D()
651658
self._update()
@@ -658,13 +665,7 @@ def _update(self):
658665
# Place the shadow patch directly behind the inherited patch.
659666
self.set_zorder(np.nextafter(self.patch.zorder, -np.inf))
660667

661-
if self._props:
662-
self.update(self._props)
663-
else:
664-
color = .3 * np.asarray(colors.to_rgb(self.patch.get_facecolor()))
665-
self.set_facecolor(color)
666-
self.set_edgecolor(color)
667-
self.set_alpha(0.5)
668+
self.update(self._props)
668669

669670
def _update_transform(self, renderer):
670671
ox = renderer.points_to_pixels(self._ox)

0 commit comments

Comments
 (0)