Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix for _axes.scatter() array index out of bound error#12673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
phobson merged 5 commits intomatplotlib:masterfromesvhd:axes_iob
Nov 2, 2018
Merged

Fix for _axes.scatter() array index out of bound error#12673

phobson merged 5 commits intomatplotlib:masterfromesvhd:axes_iob
Nov 2, 2018

Conversation

esvhd
Copy link
Contributor

PR Summary

This is to issue#12641, fixing the index out of bound error for accessing first element of an Iterable. Solution usescbook.safe_first_element().

Added test case forcbook.safe_first_element() forpandas.Series object.

@ImportanceOfBeingErnest
Copy link
Member

Seems to be the same as#12672

@esvhd
Copy link
ContributorAuthor

#12672 at the time of writing this post still usesc[0] so would fail forpd.Series with non-0 starting index. Need to usesafe_first_element() which is what this PR uses.

@jklymakjklymak added this to thev3.0.x milestoneOct 31, 2018
@jklymak
Copy link
Member

Looks like this also needs a test for the use case that was causing the original issue?

@esvhd
Copy link
ContributorAuthor

esvhd commentedOct 31, 2018 via email

Sure, I can put one in later. Thought that since we used existing helper we didn’t need one, but probably best to add that test case.
Sent from my iPhone
On 31 Oct 2018, at 01:10, Jody Klymak ***@***.***> wrote: Looks like this also needs a test for the use case that was causing the original issue? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

@jklymak
Copy link
Member

You want a test that tests the scatter use cases so no one inadvertently breaks this functionaility in the future by modifying your check. The API is quite flexible (some might say too flexible) and its hard to anticipate every usecase when making changes, so we hope the tests catch them.

@esvhd
Copy link
ContributorAuthor

How does this look? 2 new test cases added, fixed a an easy formatting line on the way.

Borrowed the empty test case from@timhoffm.

The other test case is for the non-zero indexedpd.Series raised by@montebhoover.

montebhoover reacted with thumbs up emoji

@esvhd
Copy link
ContributorAuthor

esvhd commentedNov 1, 2018 via email

Sure, let me look into it tonight.
Sent from my iPhone
On 1 Nov 2018, at 05:23, Tim Hoffmann ***@***.***> wrote:@timhoffm commented on this pull request. In lib/matplotlib/tests/test_axes.py: > @@ -5856,3 +5856,17 @@ def test_gettightbbox_ignoreNaN(): t = ax.text(np.NaN, 1, 'Boo') renderer = fig.canvas.get_renderer() np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 532.444444) + + +def test_scatter_series_non_zero_index(pd): + # create non-zero index + ids = range(10, 18) + x = pd.Series(np.random.uniform(size=8), index=ids) + y = pd.Series(np.random.uniform(size=8), index=ids) + c = pd.Series([1, 1, 1, 1, 1, 0, 0, 0], index=ids) + plt.scatter(x, y, c) + + +def test_scatter_empty_data(): + plt.scatter([], []) Can please add a comment # just making sure this does not raise an exception as I did in my PR? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Copy link
ContributorAuthor

@esvhdesvhd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added comment in test as suggested.

@phobsonphobson merged commitbcb372b intomatplotlib:masterNov 2, 2018
@phobson
Copy link
Member

Thanks for taking this on,@esvhd

@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.0.x$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 bcb372b57367b3c6ad9973eae14a72800b97324f
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #12673: Fix for _axes.scatter() array index out of bound error'
  1. Push to a named branch :
git push YOURFORK v3.0.x:auto-backport-of-pr-12673-on-v3.0.x
  1. Create a PR against branch v3.0.x, I would have named this PR:

"Backport PR#12673 on branch v3.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free tosuggest an improvement.

@esvhd
Copy link
ContributorAuthor

Thanks@phobson. Is there anything I need to do about the backport comment posted by the bot? Happy to take this over the finish line.

ImportanceOfBeingErnest pushed a commit to ImportanceOfBeingErnest/matplotlib that referenced this pull requestNov 6, 2018
Fix for _axes.scatter() array index out of bound error
@ImportanceOfBeingErnest
Copy link
Member

Trying to backport this currently fails the tests for 3.5. See#12761.

tacaswell added a commit that referenced this pull requestNov 9, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@phobsonphobsonphobson approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.0.2
Development

Successfully merging this pull request may close these issues.

6 participants
@esvhd@ImportanceOfBeingErnest@jklymak@phobson@timhoffm@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp