Skip to content

Commit

Permalink
BUG : fix non-uniform grids in pcolorfast
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Mar 16, 2015
1 parent 0346946 commit be0aed4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/matplotlib/image.py
Expand Up @@ -852,8 +852,8 @@ 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
width = int(width * magnification)
height = int(height * magnification)
if self._rgbacache is None:
A = self.to_rgba(self._A, bytes=True)
self._rgbacache = A
Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Expand Up @@ -3565,6 +3565,18 @@ def test_move_offsetlabel():
ax.yaxis.tick_right()
assert_equal((1, 0.5), ax.yaxis.offsetText.get_position())


@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) # <-- fails


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

0 comments on commit be0aed4

Please sign in to comment.