Skip to content
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

BUG : fix non-uniform grids in pcolorfast #4228

Merged
merged 1 commit into from Apr 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/matplotlib/image.py
Expand Up @@ -853,8 +853,9 @@ def make_image(self, magnification=1.0):
l, b, r, t = self.axes.bbox.extents
width = (round(r) + 0.5) - (round(l) - 0.5)
height = (round(t) + 0.5) - (round(b) - 0.5)
width = width * magnification
height = height * magnification
# The extra cast-to-int is only needed for python2
width = int(round(width * magnification))
height = int(round(height * magnification))
if self._rgbacache is None:
A = self.to_rgba(self._A, bytes=True)
self._rgbacache = A
Expand Down
11 changes: 11 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Expand Up @@ -3675,6 +3675,17 @@ def test_no_None():
assert_raises(ValueError, plt.plot, None, None)


@cleanup
def test_pcolor_fast_non_uniform():
Z = np.arange(6).reshape((3, 2))
X = np.array([0, 1, 2, 10])
Y = np.array([0, 1, 2])

plt.figure()
ax = plt.subplot(111)
ax.pcolorfast(X, Y, Z.T)


if __name__ == '__main__':
import nose
import sys
Expand Down