Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
test_tripcolor (Issue #26864) plots with datetime on x-axis only , y-axis only, and both x- and y-axis#27491
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -735,11 +735,40 @@ def test_tricontourf(self): | ||||||
fig, ax = plt.subplots() | ||||||
ax.tricontourf(...) | ||||||
@mpl.style.context("default") | ||||||
def test_tripcolor(self): | ||||||
mpl.rcParams["date.converter"] = 'concise' | ||||||
plt.style.use('_mpl-gallery-nogrid') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
The gallery-style is not used for tests (and is already set by | ||||||
fig, (ax, ax1, ax2) = plt.subplots(3, 1, figsize=(6, 4)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
dates = np.arange(np.datetime64('2022-01-01'), np.datetime64('2023-12-31'), | ||||||
np.timedelta64(1, 'D')) | ||||||
n = 256 | ||||||
np.random.seed(19680801) | ||||||
xz = np.random.uniform(-3, 3, n) | ||||||
yz = np.random.uniform(-3, 3, n) | ||||||
zz = (1 - xz / 2 + xz ** 5 + yz ** 3) * np.exp(-xz ** 2 - yz ** 2) | ||||||
# Randomly sample n dates for x-axis and different y values than above | ||||||
x_rand_dates = np.random.choice(dates, n, replace=False) | ||||||
y = np.random.uniform(-3, 3, n) | ||||||
# Randomly sample n dates for the y-axis and different x values than above | ||||||
x = np.random.uniform(-3, 3, n) | ||||||
y_rand_dates = np.random.choice(dates, n, replace=False) | ||||||
# plot: | ||||||
ax.plot(x_rand_dates, y, 'o', markersize=2, color='grey') | ||||||
ax.tripcolor(x_rand_dates, y, zz) | ||||||
ax1.plot(x, y_rand_dates, 'o', markersize=2, color='grey') | ||||||
ax1.tripcolor(x, y_rand_dates, zz) | ||||||
ax2.plot(x_rand_dates, y_rand_dates, 'o', markersize=2, color='grey') | ||||||
ax2.tripcolor(x_rand_dates, y_rand_dates, zz) | ||||||
ax.set(xlim=(min(x_rand_dates), max(x_rand_dates)), ylim=(min(y), max(y))) | ||||||
ax1.set(xlim=(min(x), max(x)), ylim=(min(y_rand_dates), max(y_rand_dates))) | ||||||
ax2.set(xlim=(min(x_rand_dates), max(x_rand_dates)), ylim=(min(y_rand_dates), | ||||||
max(y_rand_dates))) | ||||||
fig.tight_layout() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||
@pytest.mark.xfail(reason="Test for triplot not written yet") | ||||||
@mpl.style.context("default") | ||||||