Fixes matplotlib/matplotlib#1235 #6110

Merged
merged 1 commit into from Mar 7, 2016

Conversation

Projects
None yet
6 participants

Credit to @dashed, fixes #1235, supercedes #2857

The problem is that _find_best_position does not receive positions of (transformed) points from _auto_legend_data. We attempted to fix it by adding the offsets of points, after preparing the points and transforming them, and calling legendBox.count_contains on offsets.

mdboom added the needs_review label Mar 5, 2016

Contributor

dashed commented Mar 6, 2016

AppVeyor builds are failing; but I cannot make sense of the logs. Can someone enlighten me?

Owner

tacaswell commented Mar 6, 2016

See #6115 That is probably unrelated to your work

@tacaswell tacaswell and 1 other commented on an outdated diff Mar 6, 2016

lib/matplotlib/legend.py
@@ -737,6 +737,8 @@ def _auto_legend_data(self):
ax = self.parent
bboxes = []
lines = []
+ vertices = []
@tacaswell

tacaswell Mar 6, 2016

Owner

Do not need this, it looks like vertices just gets re-assigned below.

@dashed

dashed Mar 7, 2016

Contributor

Fixed.

Owner

tacaswell commented Mar 6, 2016

Other that 1 very minor style point 👍

@QuLogic QuLogic and 2 others commented on an outdated diff Mar 6, 2016

lib/matplotlib/tests/test_legend.py
@@ -261,6 +262,31 @@ def test_nanscatter():
ax.grid(True)
+@image_comparison(baseline_images=['not_covering_scatter'], extensions=['png'])
+def test_not_covering_scatter():
+ colors = ['b','g','r']
+
+ for n in range(3):
+ plt.scatter([n,], [n,], color=colors[n])
+
+ plt.legend(['foo', 'foo', 'foo'], loc='best')
+ plt.gca().set_xlim(-0.5, 2.2)
+ plt.gca().set_ylim(-0.5, 2.2)
+
+
+@image_comparison(baseline_images=['not_covering_scatter_transform'], extensions=['png'])
@QuLogic

QuLogic Mar 6, 2016

Member

I think this line is over 80 characters.

@dashed

dashed Mar 7, 2016

Contributor

Done.

I noticed the rest of the test file violates this 😉 Can be amended in a separate PR.

@tacaswell

tacaswell Mar 7, 2016

Owner

I am fine putting off fixing pep8 in the tests.

@QuLogic

QuLogic Mar 7, 2016

Member

It's actually fixed in another PR that I might just give a little nudge to some time...

@dashed dashed Fixes matplotlib/matplotlib#1235
da49463
Contributor

dashed commented Mar 7, 2016

@tacaswell I rebased against master that has #6116, and seems to work. Unsure what happened here: https://ci.appveyor.com/project/mdboom/matplotlib/build/1.0.985/job/4u3na3cignvxhg2n

Owner

tacaswell commented Mar 7, 2016

That is a known transient failure.

@tacaswell tacaswell merged commit 01c73b4 into matplotlib:master Mar 7, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

tacaswell removed the needs_review label Mar 7, 2016

Owner

tacaswell commented Mar 7, 2016

backported to v2.x as 869cc9d

Contributor

dashed commented Mar 7, 2016

Thanks @tacaswell 👍

QuLogic referenced this pull request Mar 7, 2016

Closed

fix for #1235 #2857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment