Quantcast

AW: Line2D and wx Backend

Previous Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: Line2D and wx Backend

Bugzilla from bschindler@student.ethz.ch
Yes - this code works at home and at work (Linux/windows). I fail to see why
mine won't. I checked the id's - they're correct

-----Ursprüngliche Nachricht-----
Von: John Hunter [mailto:[hidden email]]
Gesendet: Donnerstag, 25. August 2005 18:01
An: Schindler Benjamin
Cc: [hidden email]
Betreff: Re: [Matplotlib-users] Line2D and wx Backend

>>>>> "Schindler" == Schindler Benjamin <[hidden email]> writes:

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

Make sure you are working with the line you think you are

Rather than doing this

        self.axes.add_line(Line2D([],[])

do this
        self.line = Line2D([],[]
        self.axes.add_line(self.line)

After you do this

            line = self.data[source][0] # Retreive the line

check to make sure that id(line) and id(self.line) are the same.

Here is a simple example that binds events to adding line data.
Perhaps you can follow this (in wx you need to click on the figure
once before the keypress events will be processed)

from matplotlib.lines import Line2D
import matplotlib.numerix as nx
from pylab import figure, show

xdata = []
ydata = []
line = Line2D(xdata, ydata)

def add_data(event):
    if event.key!='a': return
    xdata.extend(nx.mlab.rand(10))
    ydata.extend(nx.mlab.rand(10))
    line.set_data(xdata, ydata)
    fig.canvas.draw()
   
fig = figure()
ax = fig.add_subplot(111)
ax.add_line(line)
ax.set_title("Press 'a' to add more data")
fig.canvas.mpl_connect('key_press_event', add_data)


show()



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...