Hi,
> I would like to do the following:
> 1. Display an image using pylab.imshow. Works well and I
> am happy with the v1,v2 values that are auto computed.
> Next I need to:
> 2. Display a second image using the EXACT v1,v2 values
> that matplotlib determined for the first image.
> I read through the documentation for
> matplotlib.image.AxesImage that the fisrt imshow would
> return, but could not determine exactly how to access the
> v1,v2 values for that object.
You can access the vmin and vmax attributes from the image
normalization instance and pass them on to subsequent images
In [3]: im = imshow(rand(20,20))
In [4]: im.norm.vmin
Out[4]: 0.001056874287314713
In [5]: im.norm.vmax
Out[5]: 0.99817508459091187
In [6]: newim = imshow(rand(30,30), vmin=im.norm.vmin, vmax=im.norm.vmax)
FYI, imshow returns an image.AxesImage (which derives from
colors.ScalarMappable) and this contains a colors.normalize instance,
which has the attributes you are looking for. The clim command works
by setting the vmin and vmax attrs. More details are documented here:
http://matplotlib.sourceforge.net/matplotlib.image.html#AxesImage
http://matplotlib.sourceforge.net/matplotlib.cm.html#ScalarMappable
http://matplotlib.sourceforge.net/matplotlib.colors.html#normalize
JDH