Skip to content

Add a test for Hexbin Linear #21562

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Add a test for Hexbin Linear #21562

wants to merge 4 commits into from

Conversation

llricci
Copy link
Contributor

@llricci llricci commented Nov 7, 2021

PR Summary

This PR is to fix the issue #21165:

  • A new test were add in matplotlib/lib/matplotlib/tests, with name test_hexbin_linear;
  • Also added a image file into matplotlib/lib/matplotlib/tests/baseline_images/text_axes, this image has a use, it is the image that the test will compare with.
  • Do it by adding the following:
image_comparison(baseline_images=['hexbin_linear'],
                  extensions=['png'], style='mpl20')
def test_hexbin_linear():

    np.random.seed(19680801)
    n = 100000
    x = np.random.standard_normal(n)
    y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)

    fig, ax = plt.subplots()
    h = ax.hexbin(x, y, marginals=True, reduce_C_function=np.sum)
    plt.colorbar(h)

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@jklymak
Copy link
Member

jklymak commented Nov 8, 2021

The new test is failing unfortunately. Please make sure you test with up-to-date matplotlib main on your machine first.

@jklymak jklymak marked this pull request as draft November 8, 2021 08:02
@llricci
Copy link
Contributor Author

llricci commented Nov 8, 2021

The new test is failing unfortunately. Please make sure you test with up-to-date matplotlib main on your machine first.

Yeah, sure I were going to do that.

@llricci
Copy link
Contributor Author

llricci commented Nov 8, 2021

@jklymak hey, Why the codecov/project/tests test are failing?

@jklymak
Copy link
Member

jklymak commented Nov 8, 2021

New contributors don't get all tests run automatically, but that makes codecov fail (because some tests are not being run). Nothing to worry about. I manually started your remaining tests. Thanks!

@llricci
Copy link
Contributor Author

llricci commented Nov 8, 2021

my pleasure, thank you by your help!

@llricci llricci marked this pull request as ready for review November 8, 2021 19:27
@llricci llricci requested a review from QuLogic November 9, 2021 00:32
@llricci
Copy link
Contributor Author

llricci commented Nov 9, 2021

Now why this one test are failing?

@jklymak
Copy link
Member

jklymak commented Nov 9, 2021

If you click through the failing test you can see that it was failing to connect to a server to upload artifacts, which happens sometimes, but is probably not this PRs fault.

@llricci
Copy link
Contributor Author

llricci commented Nov 9, 2021

That might be

@jklymak jklymak added this to the v3.6.0 milestone Nov 9, 2021
@llricci
Copy link
Contributor Author

llricci commented Nov 9, 2021

@jklymak Can I left like that? With this test failed?

@jklymak
Copy link
Member

jklymak commented Nov 9, 2021

The tests passed, it was just an upload of artifacts that failed, so I would say its fine.

@llricci
Copy link
Contributor Author

llricci commented Nov 9, 2021

Ok

@llricci
Copy link
Contributor Author

llricci commented Nov 9, 2021

@QuLogic I have already solved the issues you pointed out, thanks!

@llricci
Copy link
Contributor Author

llricci commented Nov 10, 2021

I just merged this branch with main, and the tests, that previously succeed in passing, now it is getting me these errors

@QuLogic
Copy link
Member

QuLogic commented Nov 10, 2021

If possible, it'd be preferred if you rebased but it looks like we'll have to squash merge to get rid of the duplicate images anyway, so that might not be necessary.

@llricci
Copy link
Contributor Author

llricci commented Nov 11, 2021

@QuLogic I rebased it, and I think it worked, the tests are now passing, but codecov/project/tests no, because as a new contributor, my tests did not run automatically

@jklymak
Copy link
Member

jklymak commented Nov 11, 2021

Your PR has a bunch of extraneous commits, hence the PR cleanliness failure. I'm not sure if a squash merge will get rid of these, if I was fixing this I would do a rebase, drop the extra commits, and then rebase onto latest master. Back up your branch before you do this though so you don't lose anything! Maybe others will have better advice.

(back up means do git checkout fix-21165; git checkout -b tmp-backup; git checkout fix-21165 and then do the rebasing. If you don't know how to rebase, you will probably need to read a guide online, but git rebase i 12345678 where 12345678 is the last commit in git log that you did not author just before the first commit you did author.

@llricci
Copy link
Contributor Author

llricci commented Nov 11, 2021

@jklymak Apparently solved

@llricci llricci changed the title Resolve issue #21165, Add Hexbin Linear Test Add a test for Hexbin Linear Nov 12, 2021
@llricci
Copy link
Contributor Author

llricci commented Nov 12, 2021

How can I fix the fact that my baseline image is duplicated? I delete it in my local repo and push it? Any idea?

@QuLogic
Copy link
Member

QuLogic commented Nov 12, 2021

You almost had the rebase, but after rebasing, you have to force push up to GitHub. If you pull, you just get back the old commits again and merge them into the history again.

@QuLogic
Copy link
Member

QuLogic commented Nov 12, 2021

So I see that #21339 also exists, but has not been updated in some time. However, it was also blocked on #21349, so I think cannot merge this until that is fixed; is that right @timhoffm?

@llricci
Copy link
Contributor Author

llricci commented Nov 12, 2021

@QuLogic So I will have to do the rebase again? If so, could you write a small guide please? I've never done a rebase and the texts I found on internet is a little confusing.

@jklymak
Copy link
Member

jklymak commented Nov 12, 2021

You did it right the first time, you just then undid your work by doing a git pull before force-pushing your changes to GitHub. (Also, please don't ask us to write unique guides for every PR... we have our own guide, listed in the docs, and there are lots of docs online. If you have a specific question about a step, feel free to ask on gitter, thanks for your understanding).

@llricci
Copy link
Contributor Author

llricci commented Nov 12, 2021

Ok, Sorry by the request, I am learning a lot contributing with open source software.

Lucas Ricci added 4 commits November 12, 2021 19:15
author Lucas Ricci <llricci@aluno.crb.g12.br> 1636671767 -0300
committer Lucas Ricci <llricci@aluno.crb.g12.br> 1636755318 -0300

parent 29a3707
author Lucas Ricci <llricci@aluno.crb.g12.br> 1636671767 -0300
committer Lucas Ricci <llricci@aluno.crb.g12.br> 1636755293 -0300

deleted and updated baseline image for test_hexbin_linear()

Resolve issue #21165, Add Hexbin Linear test

a little correction in the code

update

Update

update

update

a few corrections

Resolve issue #21165, Add Hexbin Linear test

a little correction in the code

Resolve issue #21165, Add Hexbin Linear test

a little correction in the code

update

Update

update

update

a few corrections

removing a typo where hexbon_linear() were duplicated
@llricci
Copy link
Contributor Author

llricci commented Nov 13, 2021

The tests passed now! Great.

@llricci llricci requested a review from jklymak November 13, 2021 14:30
@timhoffm
Copy link
Member

So I see that #21339 also exists, but has not been updated in some time. However, it was also blocked on #21349, so I think cannot merge this until that is fixed; is that right @timhoffm?

@QuLogic a bit confused by this and that, but yes, it is preferable if we can solve #21349 before we merge this pull request here.

@llricci
Copy link
Contributor Author

llricci commented Nov 13, 2021

@timhoffm So what is gonna be the approach in that case?

@jklymak
Copy link
Member

jklymak commented Nov 14, 2021

Right, this PR is fine, but the marginals may change under #21339, so adding the image, and then re-adding it is unecessary churn in our repo. So I'll mark this as depending on another PR and move to draft for now. Thanks for your patience @LucasRicci

@jklymak jklymak marked this pull request as draft November 14, 2021 11:59
@llricci
Copy link
Contributor Author

llricci commented Nov 14, 2021

@jklymak Just for further information, what is the max period that a PR should be inactivity to be closed?

@jklymak
Copy link
Member

jklymak commented Nov 14, 2021

Just subscribe to upstream issue and when it is merged you can move this one to "ready"

@QuLogic QuLogic modified the milestones: v3.6.0, v3.7.0 Jul 5, 2022
@llricci llricci marked this pull request as ready for review July 13, 2022 15:49
@llricci
Copy link
Contributor Author

llricci commented Jul 13, 2022

@timhoffm Moving this PR to ready since #21339 was merged

@QuLogic
Copy link
Member

QuLogic commented Jul 13, 2022

This appears to need a rebase now, though looking again, it appears that this duplicates #21339?

@llricci
Copy link
Contributor Author

llricci commented Jul 14, 2022

@QuLogic Idk, but if so, I'll close this PR

@timhoffm
Copy link
Member

The test is already covered in #21339 now. @LucasRicci I'm sorry that there has been overlapping work, but the objective of #21339 changed after we realized that the behavior was in fact correct and a test was then added for this.

Anyway, thank you for the PR. Even though this was not merged, your contributions is valuable to bring the discussion forward.

@timhoffm timhoffm closed this Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants