Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: pcolormesh with no x y args and nearest interp #29209

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

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 30, 2024

These should be equal, but they are not on master:

import numpy as np
import matplotlib.pyplot as plt

fig_test = plt.figure()
fig_ref = plt.figure()

x = np.arange(4)
y = np.arange(7)
X, Y = np.meshgrid(x, y)
C = X + Y

ax = fig_test.subplots()
ax.pcolormesh(C, shading="nearest")

ax = fig_ref.subplots()
ax.pcolormesh(x, y, C, shading="nearest")

plt.show()

On main the first figure is

Bad

and the second figure is

Good

With this change they are both the same, and look like the second figure.

Closes #29179

PR summary

PR checklist

@rcomer rcomer added this to the v3.10.0 milestone Nov 30, 2024
@rcomer rcomer merged commit 5c946bb into matplotlib:main Nov 30, 2024
42 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Nov 30, 2024
@jklymak jklymak deleted the fix-pcolormesh-nearest-noargs branch November 30, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect pcolormesh when shading='nearest' and only the mesh data C is provided.
3 participants