Line2D and wx Backend

Hi - I'm having problems - I don't get any line displayed on my screen. My code looks as follows (Init):

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)

        self.canvas = FigureCanvas(self.Panel, -1, self.figure)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.Panel.SetSizer(self.sizer)

Some event will occur and do the following (it does):
        self.axes.add_line(Line2D([],[])

As soon this event arrives, I'll receive data:

def receive(self, data, source):
            line = self.data[source][0] # Retreive the line
            xdata = line.get_xdata()
            ydata = line.get_ydata()
            for x in data:
                xdata.append(x[2]) # The data I've received
                ydata.append(x[0])
                
            self.data[source][0].set_data(xdata, ydata) # Set the data
            self.canvas.draw()
            self.canvas.gui_repaint()

I do receive data, I see that I have lines in self.axes, but I never achieved to have a line on my display. What am I missing?

Thanks
Benjamin Schindler

Some event will occur and do the following (it does):
        self.axes.add_line(Line2D(,)

You really don't want to plot empty lines, as it will end up making 0,0 part of the total data range. If your data points are on the positive side of the origin and are a long way from zero you'll end up with a lot of empty space on the axis and a little squiggle of a plot off to the right. I've been meaning to file a bug report about this behavior, which I believe is caused by Numeric.array() returning Numeric.zeros((0,), 'l').

I do receive data, I see that I have lines in self.axes, but I never achieved to have a line on my display. What am I missing?

I can think of a few possible problems but wouldn't care to hazard a guess without knowing how things like event generation and handling are implemented I. If you could send an example program which exhibits this problem, I will be happy to look into it.

Ken

···

On Aug 25, 2005, at 9:33 AM, Schindler Benjamin wrote: