-
-
Notifications
You must be signed in to change notification settings - Fork 7.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 our terms of service and privacy 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?
Conversation
…nd both x- and y-axis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do something like x_random_dates = np.datetime64('2020-01-01') + x.as_type('timedelata64[D]')
? That way the underlying surface will not be randomized.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
fig.tight_layout() |
mpl.rcParams["date.converter"] = 'concise' | ||
plt.style.use('_mpl-gallery-nogrid') | ||
|
||
fig, (ax, ax1, ax2) = plt.subplots(3, 1, figsize=(6, 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fig, (ax, ax1, ax2) = plt.subplots(3, 1, figsize=(6, 4)) | |
fig, (ax, ax1, ax2) = plt.subplots(3, 1, figsize=(6, 4), layout='constrained') |
fig, ax = plt.subplots() | ||
ax.tripcolor(...) | ||
mpl.rcParams["date.converter"] = 'concise' | ||
plt.style.use('_mpl-gallery-nogrid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plt.style.use('_mpl-gallery-nogrid') |
The gallery-style is not used for tests (and is already set by @mpl.style.context("default")
).
I think that this is actually relatively recent that it works (thanks to probably #24522) but it does seem to work now, which is good. (I tested on a machine I hadn't pulled for a while on, and it didn't work, but after pulling it worked) The second plot ( |
Thats why I'd prefer the background data was retained, rather than be scrambled. |
Further testing has shown that The axis units are not updated (and in fact I'm pretty sure if we used a different scale (other than As such I'm inclined to not merge this for the time being (until the underlying problems are fixed) Though perhaps remove the |
PR summary
Added code to test the tripcolor plotting with np.datetimes, based on the tripcolor(x,y,z) example in the Matplotlib user documentation. This is one of the numerous sub-tasks identified for testing various Axes.plottype ( where plottype= hist, scatter, violin, etc.) described in issue #26864
Generated plots look like the following:
PR checklist