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

Skip to content

Plots first and last minor ticks #22331 #24661

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

Conversation

aalmasmari
Copy link
Contributor

PR Summary

Resolves issue where first and last minor ticks do not appear, as mentioned in issue #22331

PR Checklist

Documentation and Tests

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

Release Notes

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

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.

@marisawong7 marisawong7 force-pushed the Plot-first-and-last-minor-ticks-#22331 branch from eafe72c to 6351b6a Compare December 10, 2022 23:05
@aalmasmari
Copy link
Contributor Author

We're failing test_colorbar.py::test_colorbar_minorticks_on_off, and below is the image produced before our changes.
original_test
Then, this is the image produced with our changes:
actual_test_result
How is our image wrong? It seems to make sense that there be an extra minor tick on the bottom given there is one above. Also, the test sets the limit at (-1.2, 1.2) but the test's expected output has the minor ticks start at -1.1 and end at 1.3. Why is this?

@aalmasmari aalmasmari force-pushed the Plot-first-and-last-minor-ticks-#22331 branch from 6351b6a to 229d116 Compare December 12, 2022 03:03
@aalmasmari aalmasmari marked this pull request as ready for review December 12, 2022 03:56
@dstansby
Copy link
Member

It looks like the failing test is failing because you've improved the output! The test sets the colorbar limits to -1.2, 1.2, but before your PR the ticks went from -1.1 to 1.3. With your PR, the ticks go from -1.2 to 1.2, which is better. So I think all that needs doing here is for you to update the list of expected ticks on line 399 in test_colorbar.py.

@aalmasmari aalmasmari force-pushed the Plot-first-and-last-minor-ticks-#22331 branch from 229d116 to 5fa31c4 Compare January 24, 2023 19:05
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Please rebase so that you get the latest CircleCI config.

@rcomer rcomer linked an issue Jan 29, 2023 that may be closed by this pull request
@@ -106,6 +106,25 @@ def test_basic(self):
(1, 0) # a single major tick => no minor tick
]

def test_first_and_last_minorticks(self):
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little concerned that this didn't test before!

tmin = ((vmin - t0) // minorstep + 1) * minorstep
tmax = ((vmax - t0) // minorstep + 1) * minorstep
locs = np.arange(tmin, tmax, minorstep) + t0
tmin = round((vmin - t0) / minorstep)
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs an API change note. /doc/api/next_api_changes/behavior is the correct place for this.

@rcomer
Copy link
Member

rcomer commented Mar 11, 2023

Hi @aalmasmari are you still interested in working on this? I haven’t looked closely, but I think it just needs a changenote.

@rcomer rcomer force-pushed the Plot-first-and-last-minor-ticks-#22331 branch from e3e3960 to d1a9825 Compare April 22, 2023 09:07
@rcomer
Copy link
Member

rcomer commented Apr 22, 2023

I think it would be good to get this in, so I took the liberty of squashing the commits and adding a changenote. I also reverted some white space changes.

@rcomer rcomer added topic: ticks axis labels PR: bugfix Pull requests that fix identified bugs and removed status: needs documentation labels Apr 22, 2023
@rcomer rcomer added this to the v3.8.0 milestone Apr 22, 2023
@QuLogic QuLogic merged commit c2a9793 into matplotlib:main Apr 25, 2023
@QuLogic
Copy link
Member

QuLogic commented Apr 25, 2023

Thanks @aalmasmari! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bugfix Pull requests that fix identified bugs topic: ticks axis labels
Projects
Development

Successfully merging this pull request may close these issues.

[Bug]: First and or last minor ticks sometimes not plotted
8 participants