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

Skip to content

Add datetime testing for boxplot #26986

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

Closed

Conversation

ayushrathore111
Copy link

@ayushrathore111 ayushrathore111 commented Oct 3, 2023

PR summary

I have added the code corresponding screenshots for the boxplot testing function in test_datetime.py file. and completed the portion for Axes.boxplot of issue #26864".
-->

PR checklist

bar
boxplot

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.

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.

See comments, but the biggest thing is that we are testing our builtin datetime support here, not pandas datetime support.

Comment on lines +406 to +409
instance = TestDatetimePlotting()


instance.test_boxplot()
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
instance = TestDatetimePlotting()
instance.test_boxplot()

This seems to have been put in for testing purposes

Copy link
Author

Choose a reason for hiding this comment

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

yes this i forgot to remove

fig, ax = plt.subplots()
ax.boxplot(...)

df = pd.DataFrame({'date': pd.to_datetime(['2023-01-01', '2023-02-01', '2023-03-01', '2023-04-01', '2023-05-01']),
Copy link
Member

Choose a reason for hiding this comment

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

Can we do a numpy/list of datetime object version of this?

We do not want to test Pandas converters here, we want to test our own. (We actually do have a few tests to make sure we don't fully break pandas elsewhere, but that is not the intent of this module)

Copy link
Author

Choose a reason for hiding this comment

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

okay !! I'm gonna change this..

df = pd.DataFrame({'date': pd.to_datetime(['2023-01-01', '2023-02-01', '2023-03-01', '2023-04-01', '2023-05-01']),
'value': [10, 20, 30, 40, 50]})
plt.figure()
plt.bar(df['value'], df['date'])
Copy link
Member

Choose a reason for hiding this comment

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

A bar graph is not a boxplot, and therefore does fit this unit test

Also a (vertical) bar graph with date values on the y axis will generally need a bottom argument as there is nothing about 1970-01-01 that is likely meaningful to the plot you are making.

Copy link
Author

Choose a reason for hiding this comment

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

i'll remove the bar graph..

@QuLogic QuLogic changed the title boxplot code added Add datetime testing for boxplot Oct 3, 2023
@QuLogic
Copy link
Member

QuLogic commented Oct 3, 2023

Please use more specific titles for your PR/commit message; I have modified the title here to be clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

[TST]: increase unit test coverage
4 participants