Colorbar Updates...

Hello NG,

    I haven't stated my question very clearly, probably. I
am trying to use imshow() with a dinamically changing set of matrices.
What my application does, is just to respond to a user selection from
awxPython radiobutton and, based on the user's choice, display a
different matrix on a matplotlib figure (I am using the OO interface).
I also have an horizontal colorbar to let the user orient himself over
the matrix values. Well, these matrices have different magnitues in
value, and I was expecting that the colorbar would be updated with the
new image data.
Isn't the colorbar supposed to update when the input
image/pcolor/whatever changes?

I attach a modified example of
dynamic_image_wxagg2.py that demonstrates the problem: the values in
the image increase, but the colorbar stays quiet at its bounds
(0.0,2.0) and ends up filled only with blue...

Does anyone have a
suggestion?

Thank you.

Andrea.

dynamic_image_wxagg2.py (3.82 KB)

Andrea,

  I agree, the colorbar should dynamically update. A workaround might be to simply call colorbar every time you update the image data.

At least part of a longer-term solution may be to change colorbar so that instead of always using contourf, it uses imshow when it is being used with a nearly continuous set of colors instead of a small discrete set.

I have not had time to look at this closely, but I can add it to my list.

Eric

andrea_gavana@...517... wrote:

···

Hello NG,

    I haven't stated my question very clearly, probably. I am trying to use imshow() with a dinamically changing set of matrices.
What my application does, is just to respond to a user selection from awxPython radiobutton and, based on the user's choice, display a different matrix on a matplotlib figure (I am using the OO interface). I also have an horizontal colorbar to let the user orient himself over the matrix values. Well, these matrices have different magnitues in value, and I was expecting that the colorbar would be updated with the new image data. Isn't the colorbar supposed to update when the input image/pcolor/whatever changes?

Eric Firing wrote:

Andrea,

I agree, the colorbar should dynamically update. A workaround might be to simply call colorbar every time you update the image data.

At least part of a longer-term solution may be to change colorbar so that instead of always using contourf, it uses imshow when it is being used with a nearly continuous set of colors instead of a small discrete set.

I have not had time to look at this closely, but I can add it to my list.

Eric

Although updating the colorbar when the image data changes should be the default behaviour will there be a way to keep the colorbar from changing? I've got a visualization application where an image changes according to the position it's currently displaying but I want to keep the colorbar that reflects the largest value. Right now I just display first the image that has the largest value and the colorbar stays the same. Whatever the buggy behaviour an application has someone is taking advantage of it :slight_smile:

João Silva

It sounds like there are two questions here: whether the colorbar correctly tracks the actual color mapping used in the image or contour plot or whatever (it should always do this, but I think that at present it does not), and whether the limits should change even if the mapping does not. I think the behavior you request is sensible, so that would be my target, either as a standard behavior or as an option. Thanks for pointing out this aspect of the problem.

There is another problem with the colorbar code, and I have been trying to decide how to handle that before looking at the update question, so I have not resolved either one yet.

Eric

João Luís Silva wrote:

···

Eric Firing wrote:

Andrea,

I agree, the colorbar should dynamically update. A workaround might be to simply call colorbar every time you update the image data.

At least part of a longer-term solution may be to change colorbar so that instead of always using contourf, it uses imshow when it is being used with a nearly continuous set of colors instead of a small discrete set.

I have not had time to look at this closely, but I can add it to my list.

Eric

Although updating the colorbar when the image data changes should be the default behaviour will there be a way to keep the colorbar from changing? I've got a visualization application where an image changes according to the position it's currently displaying but I want to keep the colorbar that reflects the largest value. Right now I just display first the image that has the largest value and the colorbar stays the same. Whatever the buggy behaviour an application has someone is taking advantage of it :slight_smile:

João Silva

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options