From: Ken M. <km...@gm...> - 2005-08-31 03:51:46
|
On Aug 30, 2005, at 10:29 PM, John Hunter wrote: > I suggest you follow pick through set_data and make_image in the image > module to see if you can sort out what is going wrong. Alternatively, > if you post an example then I can take a look. I've done Abraham's work for him this time, and attached an example which demonstrates behavior that he *may* be seeing. The problem is that the minimum and maximum values of the image are determined every time the image is asked to draw itself (in matplotlib.image.AxesImage.__draw()). I assume that what's happening is that the colors aren't fading down the color ramp as the values decay, but are rather staying constant or blurring a little. This happens because the color ramp is being applied across the current minimum and maximum of the data, rather than across some absolute scale. The solution to this (see the attached script for the example) is to specify a vmin and vmax, which will pin the top and bottom of the color ramp to those values: # assuming z0 is the initial MxN array that is being decayed... z_min = min(nx.minimum.reduce(z0)) z_max = max(nx.maximum.reduce(z0)) image = axes.imshow(z0, vmin=z_min, vmax=z_max) As an aside: I'd love to hear if anyone knows of a nicer way to get Numeric to give you the minimum value of a matrix. Ken |