[matplotlib-devel] FIFOBuffer.add() calls Bbox.update(), not a method
Hello. I was doing a simple test using a FIFOBuffer. I set the dataLim parameter to the dataLim of a Line2D plot. After adding a value to the FIFO, it raises an exception. It looks like the FIFO is trying to call Bbox.update(), but that method does not exist. Other update_*() methods do. Any ideas? Here's a snippet: import matplotlib.pyplot as plt from matplotlib.mlab import FIFOBuffer as FIFO f = FIFO(100) p = plt.plot([0,1,2],[0,1,2]) f.dataLim = p[0].get_axes().dataLim plt.draw() f.add(3,3) Here's the exception: Traceback (most recent call last): File "C:\fifo.py", line 9, in f.add(3,3) File "C:\Python26\lib\site-packages\matplotlib\mlab.py", line 1103, in add self.dataLim.update(xys, -1) #-1 means use the default ignore setting AttributeError: 'Bbox' object has no attribute 'update' -- View this message in context: http://www.nabble.com/FIFOBuffer.add%28%29-calls-Bbox.update%28%29%2C-not-a-method-tp25088841p25088841.html Sent from the matplotlib - devel mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] FIFOBuffer.add() calls Bbox.update(), not a method
With regards to the update() function, is it supposed to actually add the data point to the graph? After making the change and re-running the program, the plot does not contain the new data point. Thanks, Ryan John Hunter-4 wrote: > > On Fri, Aug 21, 2009 at 6:24 PM, Ryanitus wrote: >> >> Hello. >> >> I was doing a simple test using a FIFOBuffer. I set the dataLim >> parameter >> to the dataLim of a Line2D plot. After adding a value to the FIFO, it >> raises an exception. It looks like the FIFO is trying to call >> Bbox.update(), but that method does not exist. Other update_*() methods >> do. >> Any ideas? > > In mpl 0.98 we did a big refactoring of the transformations > infrastructure but this class was not properly poprted. I've fixed it > in the svn release branch so it should be fixed in the next release > (0.99.1) > > Thanks for the report, > JDH > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > -- View this message in context: http://www.nabble.com/FIFOBuffer.add%28%29-calls-Bbox.update%28%29%2C-not-a-method-tp25088841p25090188.html Sent from the matplotlib - devel mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] cbook.py, maxdict class key checking on __setitem__
I may have found a bug in the __setitem__ method of the maxdict class. Since a dictionary is a mapping class, if an item is set that already exists, it overwrites the previous. However, you are still appending that item to _killkeys regardless. In the case where 2 items with the same key were added and later removed due to size constraints, the line in bold would throw an exception on the second call. By checking for the key existance, you handle that situation gracefully. The item can still be removed from _killkeys, since it's the next to go anyway. Ryan Original code (circa line 776): if len(self)>=self.maxsize: del self[self._killkeys[0]] del self._killkeys[0] dict.__setitem__(self, k, v) self._killkeys.append(k) Possible solution: if len(self)>=self.maxsize: if self.has_key(self._killkeys[0]): del self[self._killkeys[0]] del self._killkeys[0] dict.__setitem__(self, k, v) self._killkeys.append(k) -- View this message in context: http://www.nabble.com/cbook.py%2C-maxdict-class-key-checking-on-__setitem__-tp25090453p25090453.html Sent from the matplotlib - devel mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel