update colorbar on new incoming data

Hi All,

The User of my program should use a slider element which lets compute
x,y and z and then my colorbar should also be updated with the new
computed x,y, and z values.

How to do this ?

There is a set_colorbar() method, but i dont know how to use it.
I also found a set_axes() method.

Here comes a clip of my code:
    def drawhistogram(self,min,max):
        if not hasattr(self, 'subplot3'):
            self.subplot3 = self.figure.add_subplot(111)
            self.subplot3.grid(True)
        x,y,z = self.computehistogram(self.rastertime)
        X,Y = meshgrid(x,y)
        self.plots3 = self.subplot3.pcolor(X,Y,np.transpose(z))
        self.figure.colorbar(self.plots3)

    def repainthistogram(self,rastertime):
        x,y,z = self.computehistogram(rastertime)

What for methods to use in my repainthistogram() method ?

regards Markus

feldmaus wrote:

Hi All,

The User of my program should use a slider element which lets compute
x,y and z and then my colorbar should also be updated with the new
computed x,y, and z values.

How to do this ?

There is a set_colorbar() method, but i dont know how to use it.
I also found a set_axes() method.

Here comes a clip of my code:
    def drawhistogram(self,min,max):
        if not hasattr(self, 'subplot3'):
            self.subplot3 = self.figure.add_subplot(111)
            self.subplot3.grid(True)
        x,y,z = self.computehistogram(self.rastertime)
        X,Y = meshgrid(x,y)
        self.plots3 = self.subplot3.pcolor(X,Y,np.transpose(z))
        self.figure.colorbar(self.plots3)

    def repainthistogram(self,rastertime):
        x,y,z = self.computehistogram(rastertime)

What for methods to use in my repainthistogram() method ?

If x,y don't change, and if you are not using masked arrays, then you might be able to add something like this:

         self.plots3.set_array(np.transpose(z).ravel())
         self.plots3.autoscale()
         self.figure.canvas.draw()

The colorbar range will be updated automatically.

If x,y do change, then just clear the figure and regenerate it with the new data.

Eric

···

regards Markus

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options