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

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

Open
bikegeek wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
frombikegeek:issue-26864-test-tripcolor

Conversation

bikegeek
Copy link

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:

Screenshot 2023-12-09 at 8 12 26 PM

PR checklist

Copy link
Member

@jklymakjklymak left a 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 likex_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()
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
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))
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
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')
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
plt.style.use('_mpl-gallery-nogrid')

The gallery-style is not used for tests (and is already set by@mpl.style.context("default")).

jklymak reacted with thumbs up emoji
@ksundenksunden mentioned this pull requestDec 11, 2023
64 tasks
@ksunden
Copy link
Member

I think that this is actually relatively recent that itworks (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 (ax1) looks odd, though... but I think that is just an aspect ratio/different scales on the axes problem, (the triangles are drawn essentially to maximize the minimum angle of the triangles, but that computation is done in x-y space, not in screen space so we are squishing some down so that they have smaller angles.) I don't think there is much to do here, as it iscorrect, but it did flag for me as odd.

@jklymak
Copy link
Member

Thats why I'd prefer the background data was retained, rather than be scrambled.

@ksunden
Copy link
Member

ksunden commentedDec 12, 2023
edited
Loading

Further testing has shown thattripcolor doesnot actually behave as we wish it to, issue opened in#27499 to track it.

The axis units are not updated (and in fact I'm pretty sure if we used a different scale (other thanD) the values would be off, it just happens to match mpl's internal model)

As such I'm inclined to not merge this for the time being (until the underlying problems are fixed)

Though perhaps remove theplot calls, since those hide the problem (by setting the axis units) so that this test is largely ready when the time comes. (along with some of the other edits)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak left review comments

@oscargusoscargusoscargus left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@bikegeek@ksunden@jklymak@oscargus@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp