Skip to content

pcolorfast fails in master when image is not uniform #4227

@u55

Description

@u55

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions