Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add test for remaining axis options #24668

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

Merged
merged 1 commit into from
Dec 15, 2022
Merged

Conversation

oscargus
Copy link
Member

@oscargus oscargus commented Dec 8, 2022

PR Summary

These three were not tested. Selected data so that they would show up slightly different at least.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@oscargus oscargus added this to the v3.7.0 milestone Dec 8, 2022
@oscargus oscargus force-pushed the axisoptionstest branch 2 times, most recently from cfbbb65 to 378ce5b Compare December 8, 2022 20:43
@QuLogic
Copy link
Member

QuLogic commented Dec 10, 2022

Since these options talk about making circles circular, I wonder if it might be clearer to plot circles here?

@oscargus oscargus marked this pull request as draft December 10, 2022 08:15
@oscargus oscargus marked this pull request as ready for review December 10, 2022 12:40
@oscargus
Copy link
Member Author

I've added a circle as well. Cannot really find a case where 'scaled' and 'image' differs though.

def test_axis_options():
fig, axes = plt.subplots(2, 3)
for i, option in enumerate(('scaled', 'tight', 'image')):
axes[0, i].plot((1, 2), (1, 3.2))
Copy link
Member

Choose a reason for hiding this comment

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

What's thd difference between the top and bottom tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Aspect ratio.

Copy link
Member

Choose a reason for hiding this comment

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

Is that a relevant parameter to test? I would have expected that the code paths are the same.

If it is, please add comments á la # aspect ratio > 1 to both parts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure. I guess one can get weird behavior for one of the cases, but have not checked the code paths.

Copy link
Member

Choose a reason for hiding this comment

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

Is the aspect ratio coming from just the autoscaling on the line?

Testing both of these seems relevant, the Do What I Mean code tends to be full of (and grow) special cases so (low fidelity) fuzz testing is reasonable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that is my impression. It will at least not consider a large circle.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

I have some confusion about how the aspect ratio is being controlled. The confusion is enough I do not want to push the green button, but little enough I am 👍 on someone who does not feel confused pushing the button.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Could you stick some comments in the test about why the different values being plotted are chosen? Appreciate this is testing new code so is valuable as is (and I won't blcok), but the test without any comments is a bit confusing to me.

@oscargus oscargus force-pushed the axisoptionstest branch 2 times, most recently from 2d0cf38 to 40751cb Compare December 15, 2022 20:18
@oscargus
Copy link
Member Author

I've added a bit of comments.

The idea was basically to just try it with a few different scenarios to make sure that we do not break it later. At least not unless it is on purpose.

(Also, I like high coverage numbers...)

@dstansby dstansby merged commit deb03d8 into matplotlib:main Dec 15, 2022
@oscargus oscargus deleted the axisoptionstest branch December 15, 2022 21:25
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.

6 participants