Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1499e1

Browse files
committed
Merge pull request #6350 from tacaswell/fix_cross_figure_patch_legend
FIX: cross figure legends with patches
2 parents d56d544 + 7119592 commit e1499e1

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,8 +3159,8 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
31593159
``shownotches`` is also True. Otherwise, means will be shown
31603160
as points.
31613161
3162-
Additional Options
3163-
---------------------
3162+
Other Parameters
3163+
----------------
31643164
The following boolean options toggle the drawing of individual
31653165
components of the boxplots:
31663166
- showcaps: the caps on the ends of whiskers

lib/matplotlib/patches.py

Lines 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

Lines 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)