On Tue, May 27, 2008 at 3:55 PM, Darren Dale <[EMAIL PROTECTED]> wrote:

> On the trunk, the following script will show an image but will not rescale it:
>
> im=imshow(rand(10,10))
> im.set_clim(0,0.2)
> draw()

I see that too -- and another image related bug:

In [177]: imshow(rand(10,10))
Out[177]: <matplotlib.image.AxesImage object at 0x1003acec>

In [178]: hot()

    Traceback (most recent call last):
      File "<ipython console>", line 1, in ?
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyplot.py",
line 2305, in hot
        draw_if_interactive()
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 58, in draw_if_interactive
        figManager.show()
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 338, in show
        self.canvas.draw()
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 191, in draw
        FigureCanvasAgg.draw(self)
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 255, in draw
        self.figure.draw(self.renderer)
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/figure.py",
line 792, in draw
        for a in self.axes: a.draw(renderer)
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/axes.py",
line 1394, in draw
        im.draw(renderer)
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/image.py",
line 226, in draw
        im = self.make_image(renderer.get_image_magnification())
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/image.py",
line 182, in make_image
        im.is_grayscale = self.cmap.is_gray()
      File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/colors.py",
line 504, in is_gray
        return (np.alltrue(self._lut[:,0] == self._lut[:,1])
    AttributeError: LinearSegmentedColormap instance has no attribute '_lut'

I thought at first all I would need to do is add an _init call in is_gray:

    def is_gray(self):
        if not self._isinit: self._init()
        return (np.alltrue(self._lut[:,0] == self._lut[:,1])
                    and np.alltrue(self._lut[:,0] == self._lut[:,2]))

which does indeed stop the exception but there is the same problem you
point to: the image is not updated.  I don't have time to drill into
this one right now, but they are probably the same bug.  I'm
committing the is_gray lut bugfix and punting on the deeper bug for
now.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to