From 7a563e62cc8b2110b6b262445f6fa46b04864401 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Mon, 21 Nov 2016 08:51:51 -1000 Subject: [PATCH 1/2] BUG: in Patch.update_from, use private variables directly. Closes #7375. --- lib/matplotlib/patches.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index a215ecc86786..ec37979677b5 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -193,14 +193,13 @@ def update_from(self, other): Updates this :class:`Patch` from the properties of *other*. """ artist.Artist.update_from(self, other) - self.set_edgecolor(other.get_edgecolor()) - self.set_facecolor(other.get_facecolor()) - self.set_fill(other.get_fill()) - self.set_hatch(other.get_hatch()) - self.set_linewidth(other.get_linewidth()) - self.set_linestyle(other.get_linestyle()) + self._edgecolor = other._edgecolor + self._facecolor = other._facecolor + self._fill = other._fill + self._hatch = other._hatch + self._linewidth = other._linewidth + self._linestyle = other._linestyle self.set_transform(other.get_data_transform()) - self.set_alpha(other.get_alpha()) def get_extents(self): """ From 7f93d61e57fed9a1ad9e882c6f5f929c19f4c4f7 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Mon, 21 Nov 2016 12:03:16 -1000 Subject: [PATCH 2/2] Use a setter for linestyle to handle the dash properties. --- lib/matplotlib/patches.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index ec37979677b5..9ce8383a6634 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -193,12 +193,15 @@ def update_from(self, other): Updates this :class:`Patch` from the properties of *other*. """ artist.Artist.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._fill = other._fill self._hatch = other._hatch self._linewidth = other._linewidth - self._linestyle = other._linestyle + # Use setters, getters where we need the extra work they do. + self.set_linestyle(other._linestyle) # also sets dash properties self.set_transform(other.get_data_transform()) def get_extents(self):