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

pcolorfast fails in master when image is not uniform #4227

Closed
u55 opened this issue Mar 16, 2015 · 2 comments · Fixed by #4228
Closed

pcolorfast fails in master when image is not uniform #4227

u55 opened this issue Mar 16, 2015 · 2 comments · Fixed by #4228
Assignees
Milestone

Comments

@u55
Copy link
Contributor

u55 commented Mar 16, 2015

Hi matplotlib developers,

When using master with python 2.7 on Linux, I discovered that pcolorfast fails if the image grid is not uniformly spaced. Here is a minimal working example:

import numpy as np
import matplotlib.pyplot as plt

Z = np.arange(6).reshape((3, 2))
X = np.array([0,1,2,10])  # <-- nonuniform array
Y = np.array([0,1,2])

plt.figure()
ax = plt.subplot(111)
ax.pcolorfast(X,Y,Z.T)  # <-- fails
# ax.pcolormesh(X,Y,Z.T)  # <-- works

plt.show()

This works fine in version 1.4.3, but fails in master with the following traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 341, in resizeEvent
    self.draw()
  File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 143, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 475, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 60, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 1094, in draw
    func(*args)
  File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 60, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2096, in draw
    a.draw(renderer)
  File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 60, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 881, in draw
    im = self.make_image(renderer.get_image_magnification())
  File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 869, in make_image
    bg)
TypeError: integer argument expected, got float

The same failure occurs with all of the backends that I have tried; which are specificially the wxagg, gtkagg, tkagg, and pdf backends.

Thanks for the help.

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Mar 16, 2015
@tacaswell tacaswell added this to the next point release milestone Mar 16, 2015
@tacaswell tacaswell self-assigned this Mar 16, 2015
@tacaswell
Copy link
Member

@u55 Can you see if the patch in #4228 fixes the problem for you and you get the result you expect?

@u55
Copy link
Contributor Author

u55 commented Mar 16, 2015

@tacaswell Yes, #4228 completely fixes the problem for me. Thank you.

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Apr 19, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Apr 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants