Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add datetime testing for boxplot#27038

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ayushrathore111 wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromayushrathore111:main
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletionslib/matplotlib/tests/test_datetime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -224,8 +224,17 @@ def test_barh(self):
@pytest.mark.xfail(reason="Test for boxplot not written yet")
@mpl.style.context("default")
def test_boxplot(self):
fig, ax = plt.subplots()
ax.boxplot(...)
data = [datetime.datetime(2023, 10, 5, 18, 52, 59),
datetime.datetime(2023, 10, 4, 18, 53, 0),
datetime.datetime(2023, 10, 3, 18, 53, 1),
datetime.datetime(2023, 10, 2, 18, 53, 2),
datetime.datetime(2023, 10, 1, 18, 53, 3)]
datums = np.array([datetime.datetime.toordinal(d) for d in data])
plt.boxplot(datums, labels=['my data'], showfliers=True)
Comment on lines +232 to +233
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
datums=np.array([datetime.datetime.toordinal(d)fordindata])
plt.boxplot(datums,labels=['my data'],showfliers=True)
plt.boxplot(data,labels=['my data'],showfliers=True)

We actually very specificallywant the datetimes passed into the plotting methods here. as it stands, this test is not actually testing the unit conversion at all.

plt.xlabel('Datetime')
plt.ylabel('value')
plt.title('Boxplot of datetime data')
plt.show()

@mpl.style.context("default")
def test_broken_barh(self):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp