[Matplotlib-users] Updating Scatter Plot data
Hi, I was just curious if there is a way to update the data for a scatter plot similar to the set_data function for a axes.plot object? The reason is because I need to update a scatter plot at various zoom levels and colors/distribution of the circles will change with the zoom level. I looked at the output from the get_paths and it does not correspond to the vertices of circles that are in the plot. Any help would be greatly appreciated. Thanks, Aman -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Updating Scatter Plot data
I found one method to work around this. I iterate through the list of collections by accessing the axes.collections list and checking to see if the type of the collection is a CircleCollection. If so, I remove the item then redraw the collection for the appropriate zoom level. This doesn't really seem like an optimal way of doing this though. -Aman On Wed, Jul 7, 2010 at 4:36 PM, Aman Thakral aman.thak...@gmail.com wrote: Hi, I was just curious if there is a way to update the data for a scatter plot similar to the set_data function for a axes.plot object? The reason is because I need to update a scatter plot at various zoom levels and colors/distribution of the circles will change with the zoom level. I looked at the output from the get_paths and it does not correspond to the vertices of circles that are in the plot. Any help would be greatly appreciated. Thanks, Aman -- Aman Thakral B.Eng Biosci, M.Eng Design -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Updating a plot as data is acquired
Hello, I am trying to write an application that measures data from an external device and then displays the data on a graph, updating the graph when new measurements arrive. Searching the web has led to matplotlib and so I've been having a go at using that for my program. After searching around on the forums, I have had some success in implementing the functionality I am aiming for, but the application gets very very slow the longer it runs. I have attached the test program I wrote at the bottom of this post. The application uses Tkinter for the GUI. Whenever you type something into the text box at the top, the ascii code of the last character in the text is added to the data list and plotted. The more things you type, the application gets slower and slower. I initially thought that the slow down might be due to the data list getting bigger and bigger, but I no longer think that this is the case. If you comment out line 31 (self.data.append(ord(self.text.get()[-1]))) and replace it with something like self.data = [1, 2, 3], the application still exhibits the same slow down with time. Is there a 'proper' way of doing this? Thanks, --Amr PS remove the comment at the bottom of the file (root.mainloop()) http://www.nabble.com/file/p23573077/pylog.py pylog.py -- View this message in context: http://www.nabble.com/Updating-a-plot-as-data-is-acquired-tp23573077p23573077.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Updating a plot as data is acquired
On Sat, May 16, 2009 at 6:57 AM, amrbekhit amrbek...@gmail.com wrote: Hello, I am trying to write an application that measures data from an external device and then displays the data on a graph, updating the graph when new measurements arrive. Searching the web has led to matplotlib and so I've been having a go at using that for my program. After searching around on the forums, I have had some success in implementing the functionality I am aiming for, but the application gets very very slow the longer it runs. By default matplotlib overplots, meaning it keeps the old data around in addition to the new data, so you are plotting on the i-th iteration 0: [d0] 1: [d0], [d0, d1][d0], [d0, d1] 2: [d0], [d0, d1], [d0, d1, d2], You probably don't see it because the new points overlap the old. If you turn overplotting off ax.hold(False) before issuing the plot commands you should not see the dramatic slowing. You can speed up the performance further by reusing the same line object, eg somelimit = 1000 line, = ax.plot([], []) xs = [] ys = [] for row in mydata: xs.append(row['newx']) ys.append(row['newy']) if len(xs)somelimit: del xs[0] del ys[0] line.set_data(xs, ys) ax.figure.canvas.draw() See also the animation tutorial and examples http://www.scipy.org/Cookbook/Matplotlib/Animations http://matplotlib.sourceforge.net/examples/animation/index.html JDH -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Updating a plot
Hello everybody, I would like to create a plot from which I set the x data later. The method set_xdata works but the corresponding plot displays the initial x limits. Is it possible to update the plot automatically in order that the displayed plot has x limits corresponding to the newly set x data ? Here is the script that fails: import pylab fig = pylab.figure() ax = fig.add_subplot(111, label = 'plot1') p, = ax.plot([1,2,3,4,5]) p.set_xdata([10,20,30,40,50]) # ax.set_xlim([10,50]) fig.show() to update the xlim I have to add the commented line. thank you very much Eric Pellegrini -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Updating a plot
Pellegrini Eric wrote: Hello everybody, I would like to create a plot from which I set the x data later. The method set_xdata works but the corresponding plot displays the initial x limits. Is it possible to update the plot automatically in order that the displayed plot has x limits corresponding to the newly set x data ? Here is the script that fails: import pylab fig = pylab.figure() ax = fig.add_subplot(111, label = 'plot1') p, = ax.plot([1,2,3,4,5]) p.set_xdata([10,20,30,40,50]) # ax.set_xlim([10,50]) fig.show() to update the xlim I have to add the commented line. thank you very much Eric Pellegrini I think this is more or less the same question asked by C M on April 8 on this list. Can you see if the response by Ryan May is sufficient for you? -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users