Bug with pcolorfast

Hello,
Executing the following commands from ipython --pylab produces the error below:

ax = subplot(111)
ax.pcolorfast(randn(100,100))
ax.set_xlim(2000,2001)
draw()

I ran into the error in a more complicated script, but this seems to be a simple example to reproduce it.
I notice if I instead use:
ax.set_xlim(400,500)
draw()
I get the expected behavior, so it seems to be a combination of the width being smaller than the extent, and the drawing area being off screen.

My matplot lib info is

In [19]: matplotlib.get_backend()
Out[19]: ‘Qt4Agg’

In [20]: matplotlib.version
Out[20]: ‘1.0.svn’

This version was built from SVN just a couple of days ago.

Error traceback:

···

ZeroDivisionError Traceback (most recent call last)

/home/obs/workspace/backend/ in ()

/usr/local/lib/python2.6/dist-packages/matplotlib/pyplot.pyc in draw()
350 def draw():
351 ‘redraw the current figure’
–> 352 get_current_fig_manager().canvas.draw()
353
354 def savefig(*args, **kwargs):

/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_qt4agg.pyc in draw(self)
128 if DEBUG: print “FigureCanvasQtAgg.draw”, self
129 self.replot = True
–> 130 FigureCanvasAgg.draw(self)
131 self.update()
132

/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.pyc in draw(self)
313
314 self.renderer = self.get_renderer()
–> 315 self.figure.draw(self.renderer)
316
317 def get_renderer(self):

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
—> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48

/usr/local/lib/python2.6/dist-packages/matplotlib/figure.pyc in draw(self, renderer)
773
774 # render the axes

–> 775 for a in self.axes: a.draw(renderer)
776
777 # render the figure text

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
—> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48

/usr/local/lib/python2.6/dist-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
1685 if len(self.images)<=1 or renderer.option_image_nocomposite():
1686 for im in self.images:
-> 1687 im.draw(renderer)
1688 else:
1689 # make a composite image blending alpha

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
—> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48

/usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in draw(self, renderer, *args, **kwargs)
134 self.axes.get_yscale() != ‘linear’):
135 warnings.warn(“Images are not supported on non-linear axes.”)
–> 136 im = self.make_image(renderer.get_image_magnification())
137 im._url = self.get_url()
138 l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds

/usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in make_image(self, magnification)
424
425 # resize viewport to display

–> 426 rx = widthDisplay / numcols
427 ry = heightDisplay / numrows
428 im.apply_scaling(rxsx, rysy)

ZeroDivisionError: float division

G Jones wrote:

Hello,
Executing the following commands from ipython --pylab produces the error below:

ax = subplot(111)
ax.pcolorfast(randn(100,100))
ax.set_xlim(2000,2001)
draw()

I ran into the error in a more complicated script, but this seems to be a simple example to reproduce it.
I notice if I instead use:
ax.set_xlim(400,500)
draw()
I get the expected behavior, so it seems to be a combination of the width being smaller than the extent, and the drawing area being off screen.

Thank you. The error is actually coming from the image code, which pcolorfast is using in this case, and it can be reproduced with imshow.
It is now fixed in the maintenance branch, and the fix will be propagated to the trunk shortly.

Eric

···

My matplot lib info is

In [19]: matplotlib.get_backend()
Out[19]: 'Qt4Agg'

In [20]: matplotlib.__version__
Out[20]: '1.0.svn'

This version was built from SVN just a couple of days ago.

Error traceback:

---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)

/home/obs/workspace/backend/<ipython console> in <module>()

/usr/local/lib/python2.6/dist-packages/matplotlib/pyplot.pyc in draw()
    350 def draw():
    351 'redraw the current figure'
--> 352 get_current_fig_manager().canvas.draw()
    353
    354 def savefig(*args, **kwargs):

/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_qt4agg.pyc in draw(self)
    128 if DEBUG: print "FigureCanvasQtAgg.draw", self
    129 self.replot = True
--> 130 FigureCanvasAgg.draw(self)
    131 self.update()
    132

/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.pyc in draw(self)
    313
    314 self.renderer = self.get_renderer()
--> 315 self.figure.draw(self.renderer)
    316
    317 def get_renderer(self):

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
     44 def draw_wrapper(artist, renderer, *kl):
     45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
     47 after(artist, renderer)
     48

/usr/local/lib/python2.6/dist-packages/matplotlib/figure.pyc in draw(self, renderer)
    773
    774 # render the axes

--> 775 for a in self.axes: a.draw(renderer)
    776
    777 # render the figure text

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
     44 def draw_wrapper(artist, renderer, *kl):
     45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
     47 after(artist, renderer)
     48

/usr/local/lib/python2.6/dist-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
   1685 if len(self.images)<=1 or renderer.option_image_nocomposite():
   1686 for im in self.images:
-> 1687 im.draw(renderer)
   1688 else:
   1689 # make a composite image blending alpha

/usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *kl)
     44 def draw_wrapper(artist, renderer, *kl):
     45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
     47 after(artist, renderer)
     48

/usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in draw(self, renderer, *args, **kwargs)
    134 self.axes.get_yscale() != 'linear'):
    135 warnings.warn("Images are not supported on non-linear axes.")
--> 136 im = self.make_image(renderer.get_image_magnification())
    137 im._url = self.get_url()
    138 l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds

/usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in make_image(self, magnification)
    424
    425 # resize viewport to display

--> 426 rx = widthDisplay / numcols
    427 ry = heightDisplay / numrows
    428 im.apply_scaling(rx*sx, ry*sy)

ZeroDivisionError: float division

------------------------------------------------------------------------

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users