FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: Large pixels may overlap when using imshow() · Issue #31009 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: Large pixels may overlap when using imshow() #31009

Closed

Description

Bug summary

When using imshow() with a small array (large pixels), the pixel patches can end up slightly misaligned. This becomes especially obvious when thin grid lines are overlaid on the figure.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

fig,ax = plt.subplots() 
N = 12 
ax.imshow(np.random.rand(N, N)) 
seps = np.arange(-0.5, N) 
ax.vlines(seps, -0.5, N - 0.5, linewidth=1)
ax.hlines(seps, -0.5, N - 0.5, linewidth=1)
plt.show()

Actual outcome

Expected outcome

A figure where none of the pixel patches overlap their respective grid lines.

Additional information

I originally thought this was the same issue as #14143, see my original comment. Eventually that bug was fixed but this issue remained. To quote @ayshih:

Based on my investigation so far, the problem in your example is indeed distinct from the original issue, and it is very important to fix. It's not a bug internal to the image-resampling code, but rather it has to do with how image placement affects what resampling is requested and how the resampled image is drawn.

Operating system

Debian

Matplotlib Version

3.11.0.dev1652+gddd4196c7 (but first found around 3.3.0)

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

uv

Activity

  1. changed the title [-][Bug]: Large pixels may be misaligned when using imshow()[/-] [+][Bug]: Large pixels may overlap when using imshow()[/+] on Jan 21, 2026
  2. added this to the v3.11.0 milestone on Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL