Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca2f49a

Browse filesBrowse files
committed
FIX: cross figure legends with patches
Found via biocore/qiime#2117 The `update_props` method on `Patch` was setting the figure along with the style. This was setting the new patch for the legend to have the same figure as the original handle, but this is later attempted to be set to the figure the legend is in when the patch is added to the legend. This fix should not break anything as if the patch is going to be drawn it should be added to the draw tree which _should_ in turn set the correct figure.
1 parent 7cb9d1f commit ca2f49a
Copy full SHA for ca2f49a

File tree

Expand file treeCollapse file tree

2 files changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-1
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def update_from(self, other):
179179
self.set_linewidth(other.get_linewidth())
180180
self.set_linestyle(other.get_linestyle())
181181
self.set_transform(other.get_data_transform())
182-
self.set_figure(other.get_figure())
183182
self.set_alpha(other.get_alpha())
184183

185184
def get_extents(self):

‎lib/matplotlib/tests/test_legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_legend.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ def test_legend_stackplot():
240240
ax.legend(loc=0)
241241

242242

243+
@cleanup
244+
def test_cross_figure_patch_legend():
245+
fig, ax = plt.subplots()
246+
fig2, ax2 = plt.subplots()
247+
248+
brs = ax.bar(range(3), range(3))
249+
fig2.legend(brs, 'foo')
250+
251+
243252
@cleanup
244253
def test_nanscatter():
245254
fig, ax = plt.subplots()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.