|
From: John H. <jdh...@ac...> - 2004-09-14 20:02:53
|
>>>>> "Rodrigo" == Rodrigo Caballero <rc...@ge...> writes:
Rodrigo> Ok, here's the problem, illlustrated by a simple variant
Rodrigo> of the dynamic_image_gtkagg.py example (see below). I've
Rodrigo> put in a colorbar and I'm letting the amplitude of the
Rodrigo> pattern grow linearly in time. The result is that the
Rodrigo> colormap limits remained fixed at their initial values
Rodrigo> (-2,2), rather than change in time. If I don't put in the
Rodrigo> colorbar, the colormap limits *do* change. I'm a bit
Rodrigo> confused about all this. I tried changing the
Rodrigo> normalization of the colormap doing im.autoscale(z) each
Rodrigo> time z is updated, but that doesn't work ...
OK, I understand the problem now. The reason setting the colorbar
caused the behavior you find unusual (the colormap limits remain
fixed) stems from the call to
if norm.vmin is None or norm.vmax is None:
mappable.autoscale()
in matplotlib.matlab.colorbar. When the normalization limits are
None, the normalization class automatically uses the full range. This
call to autoscale sets the normalization limits, and after that they
are fixed.
I'll have to make some changes to the code to do this right, perhaps
creating a colorbar class instance on which you can call various
methods to get the desired behavior. The question is: what is the
right default behavior, and what are the other kinds of behaviors that
should be possible? I imagine that in some cases when you set the
array data for the main window, you want to colorbar and color limits
to update and autoscale it's range, and in other cases you want the
colorbar and limits to autoscale.
JDH
|