-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
added test_axvspan in test.datetime.py #27130
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you set the random seed so that we get a reproducible result?
(We aren't doing an image test here (yet) but we are likely to make it one at some point, and just having non reproducible test cases can make tracking things down all that much harder)
https://matplotlib.org/stable/devel/testing.html#random-data-in-tests
I've added seed number |
) | ||
for i in range(np.random.randint(1, 5)): | ||
xmin = start_date + np.random.randint(0, 30) * time_delta | ||
xmax = xmin + np.random.randint(1, 3) * time_delta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my comment on #27139, please use hardcoded values here rather than random draws.
|
||
bin_edges = [start_date + i * time_delta for i in range(31)] | ||
|
||
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can shorten to fig, axes = plt.subplots(3, 1, constrained_layout=True)
, and remove axes = [ax1, ax2, ax3]
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you for adding this test coverage!
I´ve added code for
test_axvspan
method intest_datetime.py
mentioned in issue #26864Image output: (edited)

PR summary
PR checklist