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

Added test_hist in test_datetime.py#27028

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

Merged
ksunden merged 9 commits intomatplotlib:mainfromyangyangdotcom:test_hist
Oct 12, 2023
Merged
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
47 changes: 44 additions & 3 deletionslib/matplotlib/tests/test_datetime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,11 +170,52 @@ def test_hexbin(self):
fig, ax = plt.subplots()
ax.hexbin(...)

@pytest.mark.xfail(reason="Test for hist not written yet")
@mpl.style.context("default")
def test_hist(self):
fig, ax = plt.subplots()
ax.hist(...)
mpl.rcParams["date.converter"] = 'concise'

start_date = datetime.datetime(2023, 10, 1)
time_delta = datetime.timedelta(days=1)

values1 = np.random.randint(1, 10, 30)
values2 = np.random.randint(1, 10, 30)
values3 = np.random.randint(1, 10, 30)

bin_edges = [start_date + i * time_delta for i in range(31)]

fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True)
ax1.hist(
[start_date + i * time_delta for i in range(30)],
bins=10,
weights=values1
)
ax2.hist(
[start_date + i * time_delta for i in range(30)],
bins=10,
weights=values2
)
ax3.hist(
[start_date + i * time_delta for i in range(30)],
bins=10,
weights=values3
)

fig, (ax4, ax5, ax6) = plt.subplots(3, 1, constrained_layout=True)
ax4.hist(
[start_date + i * time_delta for i in range(30)],
bins=bin_edges,
weights=values1
)
ax5.hist(
[start_date + i * time_delta for i in range(30)],
bins=bin_edges,
weights=values2
)
ax6.hist(
[start_date + i * time_delta for i in range(30)],
bins=bin_edges,
weights=values3
)

@pytest.mark.xfail(reason="Test for hist2d not written yet")
@mpl.style.context("default")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp