Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def update_from(self, other):
# For some properties we don't need or don't want to go through the
# getters/setters, so we just copy them directly.
self._edgecolor = other._edgecolor
self._facecolor = other._facecolor
self._original_edgecolor = other._original_edgecolor
self._facecolor = other._facecolor
self._original_facecolor = other._original_facecolor
self._fill = other._fill
self._hatch = other._hatch
Expand Down
23 changes: 23 additions & 0 deletions lib/matplotlib/tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,29 @@ def test_contains_points():
assert np.all(result == expected)


def test_when_update_from_and_set_alpha_then_only_alpha_changes():
# given
source_facecolor = (0.234, 0.123, 0.135, 0.322)
source_edgecolor = (0.728, 0.682, 0.945, 0.268)
source = mpatches.Rectangle((0, 0), 1., 1.,
facecolor=source_facecolor,
edgecolor=source_edgecolor)
updated = mpatches.Rectangle((1., 0), 1., 1.,
facecolor='pink', edgecolor="green")
# when
updated.update_from(source)
# then
assert updated.get_facecolor() == source_facecolor
assert updated.get_edgecolor() == source_edgecolor
# when
updated.set_alpha(0.777)
# then
expected_facecolor = source_facecolor[0:3] + (0.777,)
expected_edgecolor = source_edgecolor[0:3] + (0.777,)
assert updated.get_facecolor() == expected_facecolor
assert updated.get_edgecolor() == expected_edgecolor


# Currently fails with pdf/svg, probably because some parts assume a dpi of 72.
@check_figures_equal(extensions=["png"])
def test_shadow(fig_test, fig_ref):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy