[SciPy-user] Chaco question

Jochen Schroeder cycomanic@gmail....
Sat May 16 20:02:45 CDT 2009

Hi all,

I'm trying to write a small application using chaco to check some of my
simulation results. It's actually also a bit of an exercise to learn
chaco. Currently what I have is something like this:

class ContainerTest(HasTraits):
    plot = Instance(VPlotContainer)
    traits_view = View(Item('plot', editor=ComponentEditor(),
                            width=800, height=800, resizable=True,
    def __init__(self):
        super(ContainerTest, self).__init__()
        I,f,z = load_field('test.h5')
        plotdata = ArrayPlotData(spectrum=Is)
        imageplot = Plot(self.plotdata)
        im = imageplot.img_plot("spectrum", xbounds=t,
ybounds=z, colormap=jet)[0]
        LI = LineInspector(component=self.imageplot,
write_metadata=True, inspect_mode='indexed', axis='index_y')
        line = ArrayPlotData(field=I[0],frequency=f)
        lp = Plot(self.line)
        lineplot = lp.plot(("frequency","field"), type="line")
        container = VPlotContainer(imageplot,lp)
        self.plot = container

I is a spectrum of a field depending on frequency f and propagation
distance z. So on top i have an imageplot of the spectral evolution,
while at the bottom I have just the spectrum at one point of the
evolution. What I'm trying to do with the LineInspector is that I'd like
to be able to move it up and down and choose which spectrum to display
in the bottom plot. I've looked at some of the examples and I understand
I need to at an event handler using on_trait_change, however I can't
find which object gets written the metadata to. 
Another (slight) problem I found is that if I change the interpolation
to bilinear I have a white gradient overlaying at the top and bottom of
the image.

Can anyone point me in the right direction? As I'm a bit stuck atm.


More information about the SciPy-user mailing list