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

Adding PowerScale for PowerNorm #20355#20532

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

Draft
yacth wants to merge7 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromyacth:PowerNorm-scale

Conversation

yacth
Copy link

@yacthyacth commentedJun 27, 2021
edited
Loading

PR Summary

As per the issue#20355 requirements, I added thePowerScale andPowerTransform andInvertedPowerTransform in thescale.py file following the architecture of the log norm.
I am willing to discuss thesef_default_locators_and_formatters function to set the right Locator and Formatter of the scale.

I am waiting for a review on my code and improve it if needed.

PR Checklist

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

Copy link

@github-actionsgithub-actionsbot 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 uson gitter for real-time discussion.

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

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

@dmatos2012
Copy link
Contributor

Hi@yacth. Thanks for contributing. As you can see, some of your tests are failing. To begin with, the test is complaining about formatting - clik on Linting/flake8 (pull_request) for more details. From thecontributing documents it recommends to do the following to your code:

python -m pip install flake8flake8 /path/to/module.py

which ensures formatting is done correctly. Secondly, its also complaining about needing tests for the added features, as per the website linked above:

Changes (both new features and bugfixes) should have good test coverage. See Testing for more details.
So what you have added needs to be covered by tests.

Its also important to make sure you run some tests before to make sure your changes are not breaking other features, seetesting. For the implementation details, you will have to wait for some of the other developers to review it. But it greatly helps to make sure the previous tests passed, so the conversation can focus on implementation itself.

@yacth
Copy link
Author

Hi@yacth. Thanks for contributing. As you can see, some of your tests are failing. To begin with, the test is complaining about formatting - clik on Linting/flake8 (pull_request) for more details. From thecontributing documents it recommends to do the following to your code:

python -m pip install flake8flake8 /path/to/module.py

which ensures formatting is done correctly. Secondly, its also complaining about needing tests for the added features, as per the website linked above:

Changes (both new features and bugfixes) should have good test coverage. See Testing for more details.
So what you have added needs to be covered by tests.

Its also important to make sure you run some tests before to make sure your changes are not breaking other features, seetesting. For the implementation details, you will have to wait for some of the other developers to review it. But it greatly helps to make sure the previous tests passed, so the conversation can focus on implementation itself.

Thank you for your review.

Actually since it is rewritting the original feature in another way I thought that letting the old tests should be good enough.
What do you think about it ?

@jklymak
Copy link
Member

@yacth if the old tests fail then you changed the behaviour with your changes and the new code needs to be fixed, or you need to argue that the changes you made are an improvement and rewrite the tests.

@yacth
Copy link
Author

I am working on the code, but I am stuck.
If someone can review what I have done and help me getting unblocked.

I am trying some testings using a simple code :

importmatplotlib.scaleasscalescale.PowerScale(10,0.5)

I get the following error :

TypeError:__init__()takes2positionalargumentsbut3weregiven

Which I don't understand.

Copy link
Author

@yacthyacth left a comment
edited
Loading

Choose a reason for hiding this comment

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

I did the changes to solve the errors related to thePowerNorm calculations even if there is still theset_default_locators_and_formatters in thePowerScale class is still to be determined.

I had this error:
lib/matplotlib/tests/test_axes.py::test_pcolor_regression

But by running what is inside line by line on my local environment I don't have a failure, I don't get it:

frompandas.plottingimport (register_matplotlib_converters,deregister_matplotlib_converters,    )fig=plt.figure()ax=fig.add_subplot(111)times= [datetime.datetime(2021,1,1)]whilelen(times)<7:times.append(times[-1]+datetime.timedelta(seconds=120))y_vals=np.arange(5)time_axis,y_axis=np.meshgrid(times,y_vals)shape= (len(y_vals)-1,len(times)-1)z_data=np.arange(shape[0]*shape[1])z_data.shape=shapetry:register_matplotlib_converters()im=ax.pcolormesh(time_axis,y_axis,z_data)# make sure this does not raise!fig.canvas.draw()finally:deregister_matplotlib_converters()

@story645
Copy link
Member

But by running what is inside line by line on my local environment I don't have a failure, I don't get it:

this might be silly, but can you double check which version of matplotlib and which branch you're testing against?

@jklymak
Copy link
Member

@yacth, this is looking close. Suggest you rebase on master, that should fix your build error.

This does need tests and documentation as well if you are up for it. It is hard to tell if it is working without those.

@yacth
Copy link
Author

@yacth, this is looking close. Suggest you rebase on master, that should fix your build error.

This does need tests and documentation as well if you are up for it. It is hard to tell if it is working without those.

I did a rebase, hope this will solve the failing tests.

Sure I will investigate the tests.

But first I have some questions about thelocators andformatters for here I still have something to change, because I used "default" values .

@jklymak
Copy link
Member

@yacth I've not been following this PR closely. Did you spell out the locator/formatter issues? I can imagine they are a bit thorny as there is not a natural locator for the Power Scale. Perhaps best so see how it has been used in other contexts and copy.

@melissawm
Copy link
Member

Hi@yacth - are you interested in continuing this work? If so, please mark the PR as ready for review and let us know if you need help with the rebase, we haveinstructions for that here. Thanks!

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

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@TortarTortarTortar left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@yacth@dmatos2012@jklymak@story645@melissawm@Tortar

[8]ページ先頭

©2009-2025 Movatter.jp