Hi,
unles I'm doing something stupid, setp is buggy.

I'm creating a bunch of images using imshow and I want the colormap to be consistent among images. So once they're all drawn, I want to uniformize the color scale. But

>>> setp(ax.images, clim= [0,1])

does not work because it sets vmin to [0,1] and doesn't affect vmax.

On the other hand,
>>> ax.images[0].set_clim([0,1])

works fine.

Should I file a ticket ?

David

In [1]: ax = axes()

In [2]: ax.imshow(rand(10,10))
Out[2]: <matplotlib.image.AxesImage instance at 0x2aaaad22a830>

In [3]: setp(ax.images, 'clim', [0,1])
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most recent call last)

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py in expose_event(self, widget, event)
    282                 x, y, w, h = self.allocation
    283                 self._pixmap_prepare (w, h)
--> 284                 self._render_figure(self._pixmap, w, h)
    285                 self._need_redraw = False
    286

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py in _render_figure(self, pixmap, width, height)
     71     def _render_figure(self, pixmap, width, height):
     72         if DEBUG: print ' FigureCanvasGTKAgg.render_figure'
---> 73         FigureCanvasAgg.draw(self)
     74         if DEBUG: print 'FigureCanvasGTKAgg.render_figure pixmap', pixmap
     75         #agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py in draw(self)
    390
    391         renderer = self.get_renderer()
--> 392         self.figure.draw (renderer)
    393
    394     def get_renderer(self):

/usr/local/lib/python2.4/site-packages/matplotlib/figure.py in draw(self, renderer)
    567
    568         # render the axes
--> 569         for a in self.axes: a.draw(renderer)
    570
    571         # render the figure text

/usr/local/lib/python2.4/site-packages/matplotlib/axes.py in draw(self, renderer, inframe)
   1105         if len(self.images)<=1 or renderer.option_image_nocomposite():
   1106             for im in self.images:
-> 1107                 im.draw(renderer)
   1108         else:
   1109             # make a composite image blending alpha

/usr/local/lib/python2.4/site-packages/matplotlib/image.py in draw(self, renderer, *args, **kwargs)
    179     def draw(self, renderer, *args, **kwargs):
    180         if not self.get_visible(): return
--> 181         im = self.make_image(renderer.get_image_magnification())
    182         l, b, widthDisplay, heightDisplay = self.axes.bbox.get_bounds()
    183         renderer.draw_image(l, b, im, self.axes.bbox)

/usr/local/lib/python2.4/site-packages/matplotlib/image.py in make_image(self, magnification)
    122                 im.is_grayscale = False
    123             else:
--> 124                 x = self.to_rgba(self._A, self._alpha)
    125                 im = _image.fromarray(x, 0)
    126                 if len(self._A.shape) == 2:

/usr/local/lib/python2.4/site-packages/matplotlib/cm.py in to_rgba(self, x, alpha)
     54         if hasattr(x, 'shape') and len(x.shape)>2: return x
     55         x = ma.asarray(x)
---> 56         x = self.norm(x)
     57         x = self.cmap(x, alpha)
     58         return x

/usr/local/lib/python2.4/site-packages/matplotlib/colors.py in __call__(self, value, clip)
    749         self.autoscale(val)
    750         vmin, vmax = self.vmin, self.vmax
--> 751         if vmin > vmax:
    752             raise ValueError("minvalue must be less than or equal to maxvalue")
    753         elif vmin==vmax:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()