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

Skip to content

Added datetime smoke test for Axes.hexbin #27475

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bikegeek
Copy link

@bikegeek bikegeek commented Dec 8, 2023

PR summary

This is part of the task to include additional smoke-tests for Axes. as outlined in issue #26864
A simple datetime test added for Axes.hexbin (Issue #26864) as sub-task, using only numpy datetimes and adhering to the use of the random seed 19680801. Three plots generated, one with datetime as x-axis, another with datetime as y-axis, and datetime for both x- and y-axis.

Plots look like the following:
Screenshot 2023-12-08 at 2 31 51 PM

PR checklist

@ksunden ksunden mentioned this pull request Dec 8, 2023
64 tasks
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 week or so, please leave a new comment below and that should bring it to our attention. 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.

@ksunden ksunden marked this pull request as draft December 8, 2023 21:06
@bikegeek bikegeek marked this pull request as ready for review December 8, 2023 21:19
Comment on lines 446 to 447
ax1.hexbin(dates, y, gridsize=10)
ax2.hexbin(dates, y, gridsize=10)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ax1.hexbin(dates, y, gridsize=10)
ax2.hexbin(dates, y, gridsize=10)
ax1.hexbin(y, dates, gridsize=10)
ax2.hexbin(dates, dates, gridsize=10)

Copy link
Author

Choose a reason for hiding this comment

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

Didn't commit the most recent changes. Now there are tweaks to the appearance of the plots and the appropriate hexbin arguments

Copy link
Author

Choose a reason for hiding this comment

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

Added the .rcParams["date.converter"] = 'concise' to clean up the datetime labels and updated the image in the body of the PR request.

@bikegeek
Copy link
Author

bikegeek commented Dec 8, 2023

removed the mpl.rcParams from the test_tripcolor

@bikegeek
Copy link
Author

bikegeek commented Dec 8, 2023

apologies, the commit didn't work, now the appropriate changes are appearing.

@QuLogic
Copy link
Member

QuLogic commented Dec 9, 2023

We should probably also test with the extent argument as well, and maybe also with marginals=True.

@bikegeek
Copy link
Author

added extents and set marginals in test_hexbin. Modified the gridsizes and updated the plot image in the body of the PR.

Copy link
Member

@ksunden ksunden left a comment

Choose a reason for hiding this comment

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

I think overall it is a good test, just want the extents specified as datetimes because that tests additional features that should behave as unitful data.

Comment on lines +450 to +454
extent=[19030, 19680, min(y), max(y)])
ax1.hexbin(x, dates, marginals=True, gridsize=(10, 6),
extent=[min(x), max(x), 19030, 19680])
ax2.hexbin(dates, dates, marginals=True, gridsize=(10, 6),
extent=[19030, 19900, 19030, 19680])
Copy link
Member

Choose a reason for hiding this comment

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

The extents for a date axis should probably be given in as a datetime (and if that doesn't work, we should probably know that)

These numbers are the internal representation of matplotlib dates (days since mpl.dates.get_epoch(), which defaults to 1970-01-01) but you should be able to set them to use datetimes instead.

@QuLogic QuLogic changed the title Added test for Axes.hexbin (matplotlib#27431) Added datetime smoke test for Axes.hexbin Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants