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

Attempted to add test_pcolorfast in test_datetime.py#27450

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
AndyXi163 wants to merge5 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromAndyXi163:add_test_pcolorfast
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
22 changes: 20 additions & 2 deletionslib/matplotlib/tests/test_datetime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@

import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.dates as dt


class TestDatetimePlotting:
Expand DownExpand Up@@ -545,11 +546,28 @@ def test_pcolor(self):
fig, ax = plt.subplots()
ax.pcolor(...)

@pytest.mark.xfail(reason="Test for pcolorfast not written yet")
@mpl.style.context("default")
def test_pcolorfast(self):
np.random.seed(19680801)

'''
Directly inputting either datetime.datetime or numpy.datetime64
without using date2num() seems to always generate compile errors for pcolorfast().
I have used date2num() to ensure that the graph prints correctly
despite that such operations may defy the purpose of conducting such tests.
'''
basedate_x = datetime.datetime(2023, 12, 6, 1, 30, 30)
basedate_y = datetime.datetime(2024, 5, 5, 12, 15, 45)
dates_x = [dt.date2num(basedate_x + datetime.timedelta(days=1*i, hours=6*i, minutes=20*i)) for i in range(10)]
dates_y = [dt.date2num(basedate_y + datetime.timedelta(days=1*i, hours=8*i, minutes=30*i)) for i in range(10)]
data = np.random.rand(0, 100)

fig, ax = plt.subplots()
ax.pcolorfast(...)
pc = ax.pcolorfast(dates_x, dates_y, data)

ax.set_xlabel('Sample datetime')
ax.set_ylabel('Sample data')
ax.set_title('Sample test case for pcolorfast()')

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

[8]ページ先頭

©2009-2025 Movatter.jp