From ca2f49ac9e9d7a6738caa5fb5d3c6332976d7121 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 29 Apr 2016 23:24:56 -0400 Subject: [PATCH 1/2] FIX: cross figure legends with patches Found via https://github.com/biocore/qiime/issues/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. --- lib/matplotlib/patches.py | 1 - lib/matplotlib/tests/test_legend.py | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index be93c05fbb11..0c71c73bce44 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -179,7 +179,6 @@ def update_from(self, other): self.set_linewidth(other.get_linewidth()) self.set_linestyle(other.get_linestyle()) self.set_transform(other.get_data_transform()) - self.set_figure(other.get_figure()) self.set_alpha(other.get_alpha()) def get_extents(self): diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index a43231b964ee..a03489f095b9 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -240,6 +240,15 @@ def test_legend_stackplot(): ax.legend(loc=0) +@cleanup +def test_cross_figure_patch_legend(): + fig, ax = plt.subplots() + fig2, ax2 = plt.subplots() + + brs = ax.bar(range(3), range(3)) + fig2.legend(brs, 'foo') + + @cleanup def test_nanscatter(): fig, ax = plt.subplots() From 7119592183f3e0532bb0a11aa47ec2b4a1e4b914 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 30 Apr 2016 00:18:03 -0400 Subject: [PATCH 2/2] DOC: change to numpydoc known section heading --- lib/matplotlib/axes/_axes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ab054599008a..06ecf4f2aabc 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3159,8 +3159,8 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None, ``shownotches`` is also True. Otherwise, means will be shown as points. - Additional Options - --------------------- + Other Parameters + ---------------- The following boolean options toggle the drawing of individual components of the boxplots: - showcaps: the caps on the ends of whiskers