Skip to content

Navigation Menu

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

Appearance settings

[Bug]: Units behavior of tri* methods #27499

Copy link
Copy link
Open
@ksunden

Description

@ksunden
Issue body actions

Bug summary

As seen in #27491, #27488, #27494, #27487

It appears that the tri* methods do not actually properly handle units.

Code for reproduction

fig, ax = plt.subplots()
np.random.seed(19680801)
limit_value = 30

startdate = np.datetime64("2023-12-01")

x_dates = startdate + np.random.randint(0, 15, size=(limit_value-1,)).astype("timedelta64[D]")
y_dates = startdate + np.random.randint(0, 15,size=(limit_value-1,)).astype("timedelta64[D]")

x_dates_converted = mpl.dates.date2num(x_dates)

y_data = np.random.rand(limit_value - 1)

z_data = np.sin(x_dates_converted) + np.cos(y_data)

ax.triplot(x_dates, y_dates)
ax.tripcolor(x_dates, y_dates, z_data)
#ax.tricontour(x_dates, y_dates, z_data)
#ax.tricontourf(x_dates, y_dates, z_data)

Actual outcome

Prior to (probably, though I didn't actually bisect it) #24522, the code would actually error, as it attempted to cast the x/y arrays to float64 arrays.

Now it will actually work to plot (seemingly even getting the actual values converted, though now that I think about it not sure where... my guess is that it is actually coincidental that they are datetime64[D] dtype which happens to be the same scale/epoch as mpl, but it is not actually being properly converted) however it does not set the Formatters/etc.

Expected outcome

Units are set properly (including axisinfo such as formatters).

Additional information

No response

Operating system

No response

Matplotlib Version

3.9.0.dev821+gfa6be74127 (~main currently)

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

git checkout

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.