Re: [Matplotlib-users] Problem with event handling in matplotlib in tkinter
Sorry I'm lost in the discussion. What is the relation between the weak references in callback registry and moving stuff to the figure manager? Federico On 7 Nov 2014 14:13, Thomas Caswell tcasw...@gmail.com wrote: I am also beginning to like the idea of hanging all of these things off of FigureManager objects. We have them around, but they are really only used in pyplot (which is a shame) and seems a natural place to put all of these aggregation type objects (list of animations, the toolbar stuff, the navigation stuff, the blit-manager object I want to pull in from scikit-image, etc). @Federico, tell me if I am being dumb about this. Tom On Fri Nov 07 2014 at 2:05:29 PM Thomas Caswell tcasw...@gmail.com wrote: The old-style classes are because mpl pre-dates new-style classes. On master all classes now inherit from object (as of about 3 weeks ago https://github.com/matplotlib/matplotlib/pull/3662) On Fri Nov 07 2014 at 2:02:15 PM Brendan Barnwell brenb...@brenbarn.net wrote: On 2014-11-07 09:37, Benjamin Root wrote: Figured it out! The instance of Test() isn't being retained anywhere, so when it goes out of scope, the garbage collector eventually gets it. The fact that it works in py3k is likely a coincidence as the garbage collector would eventually have cleaned it up at some point. I don't know the scoping/garbage collection rules for lambdas, so I am guessing that they persist as they are part of the code as opposed to a de-reference-able (is that even a word?). Just save the instance of Test as a member variable of App, and you should be good to go! This note in cbook.py (which handles the callback registry) explains it. . . sort of: In practice, one should always disconnect all callbacks when they are no longer needed to avoid dangling references (and thus memory leaks). However, real code in matplotlib rarely does so, and due to its design, it is rather difficult to place this kind of code. To get around this, and prevent this class of memory leaks, we instead store weak references to bound methods only, so when the destination object needs to die, the CallbackRegistry won't keep it alive. The Python stdlib weakref module can not create weak references to bound methods directly, so we need to create a proxy object to handle weak references to bound methods (or regular free functions). This technique was shared by Peter Parente on his `Mindtrove blog http://mindtrove.info/articles/python-weak-references/`_. Definitely a hidden trap! Also, speaking of the dangers of classes not inheriting from object, I noticed that CallbackRegistry in cbook.py is also an old-style class (doesn't inherit from object). I then did a search and found numerous old-style classes throughout MPL. Is there any reason for this? -- Brendan Barnwell Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail. --author unknown -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is line after remove?
Hello Finally (after long time) I managed to get time and courage to make my first PR with this little modification https://github.com/matplotlib/matplotlib/pull/2417 Federico On Tue, Mar 13, 2012 at 3:17 PM, John Hunter jdh2...@gmail.com wrote: On Tue, Mar 13, 2012 at 1:20 PM, Federico Ariza ariza.feder...@gmail.comwrote: Hi That is exactly what I am doing, but I thought it was kept somewhere. I like the idea of upstream modification of relim. It would be trivial to add a kwarg to relim: include_invisible=True which defaults to the current behavior. def relim(self, include_invisible=True): Recompute the data limits based on current artists. If you want to exclude invisible artists from the calculation, set `include_invisible=False` At present, :class:`~matplotlib.collections.Collection` instances are not supported. # Collections are deliberately not supported (yet); see # the TODO note in artists.py. self.dataLim.ignore(True) self.ignore_existing_data_limits = True for line in self.lines: if include_invisible or line.get_visible(): self._update_line_limits(line) for p in self.patches: if include_invisible or p.get_visible(): self._update_patch_limits(p) But include_invisible isn't the most intuitive name... JDH -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. http://pubads.g.doubleclick.net/gampad/clk?id=64545871iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Tabbed backend
Hi I just wanted to let you know that I did some work on tkinter to have a tabbed backend, It is in early stages but it works If you want to give it a try it is available on https://github.com/fariza/MPL-Experimental-Backend Let me know if you have any comments. Cheers Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is line after remove?
Hi That is exactly what I am doing, but I thought it was kept somewhere. I like the idea of upstream modification of relim. Thanks Federico On Tue, Mar 13, 2012 at 2:13 PM, Goyo goyod...@gmail.com wrote: El día 13 de marzo de 2012 00:25, Federico Ariza ariza.feder...@gmail.com escribió: [...] I want to turn visibility on and off for lines. I can not use the visible property, using it the autolimits relim keeps considering the lines as being there. As consequence the limits are wrong (if we think only on the visible lines). I faced this some time ago and my workaround was writing my own (simplified) version of relim, if memory serves. But this may not fit your needs here. Maybe a better solution is modify relim upstream so it can take visibility into account (maybe using a new keyword). Just a quick thought. So I resorted to remove the line from its axes by line.remove() The question is: If I do not want to use another variable to keep track of this line, how can I find it again from the figure instance (or somewhere else)? get_children gets me nowhere or maybe? I don't think matplotlib keeps a reference to a line object after you remove it from the axes. If I'm right and you want to follow that path you'll need to track it yourself. Regards Goyo -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is line after remove?
Ben Yest It is called remove but not destroy ;) Given that the relim takes in count the invisible lines, I thougth it was planned that you could remove and add the lines from its axes. Thanks Federico On Tue, Mar 13, 2012 at 2:44 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Mar 13, 2012 at 1:20 PM, Federico Ariza ariza.feder...@gmail.comwrote: Hi That is exactly what I am doing, but I thought it was kept somewhere. I like the idea of upstream modification of relim. Thanks Federico Federico, Why would you think it is kept somewhere? The method is called remove, after all. I am curious because I want to know if improvements are needed to the documentation. As for relim(), I am thinking the autoscaling system needs another revamp. I have ran into subtle issues with data limits that could not be easily fixed in the current design. rant Everything plottable should have a get/set for x and y data, as well as get/set for data (which may or may not be the same as the get/set for y. Note that there might be some confusion regarding scalar mappables. I think this might be the source of confusion where some collections have set_data() while others have set_array(). Also, not all objects, for some reason, implement remove(), or something else messed up that I am not clear about. /rant Cheers! Ben Root -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] where is line after remove?
Hi Working on my little experiment (backend with edition capabilities https://github.com/fariza/MPL-Experimental-Backend) I want to turn visibility on and off for lines. I can not use the visible property, using it the autolimits relim keeps considering the lines as being there. As consequence the limits are wrong (if we think only on the visible lines). So I resorted to remove the line from its axes by line.remove() The question is: If I do not want to use another variable to keep track of this line, how can I find it again from the figure instance (or somewhere else)? get_children gets me nowhere or maybe? # import matplotlib.pylab as plt fig = plt.figure() ax = fig.add_subplot(111) line = ax.plot(range(100)) print line[0] in ax.lines line[0].remove() print line[0] in ax.lines plt.show() # Thanks Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] backend with edition capabilities
Hi As I thought, this is a tricky subject. So far I just opened a github account and added the three files that I am using. https://github.com/fariza/MPL-Experimental-Backend I have tested this on linux, I do not know if it works on windows. I know glade is not the right way to do it if I want this to be taken serously. So far the only thing I want is to experiment and see what subset of actions are needed by most people. The code is ugly but if this is something that more people find useful, I will do something about that, if not I will keep it to myself and my personal use. Thanks Federico P.S. The group expander is because I have personal need of line group management P.S.2. The toolbar will be modified to be unified among all the figures P.S.3. The figures are arranged in a notebook because I hate having multiple open windows from the same source. P.S.4. I am thinking on adding a shell with all the figure and line instances ready to be modified by hand. On Wed, Feb 29, 2012 at 5:02 PM, Federico Ariza ariza.feder...@gmail.comwrote: Dear all I am a long time matplotlib user (under linux) but new to the list (second post). On of the things that bothers me the most is the inability of the standard backend to change simple things (line color, labels, etc...). I resorted to create a simple FrankeinBackend (based on the GtkAgg) I guess I am not the only one missing this kind of features or experimenting with similar ideas. Some points comes to my mind: Is there any special place where we can share and discuss this? Is it better if I just open a googlecode place for my code.? This is a recurring question and I have no idea what I am talking about This is already done I am reinventing the wheel Thanks Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] backend with edition capabilities
Dear all I am a long time matplotlib user (under linux) but new to the list (second post). On of the things that bothers me the most is the inability of the standard backend to change simple things (line color, labels, etc...). I resorted to create a simple FrankeinBackend (based on the GtkAgg) I guess I am not the only one missing this kind of features or experimenting with similar ideas. Some points comes to my mind: Is there any special place where we can share and discuss this? Is it better if I just open a googlecode place for my code.? This is a recurring question and I have no idea what I am talking about This is already done I am reinventing the wheel Thanks Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] impossible to deactivate minor grid in logscale
Hi If I set the scale to log and set the grid to minor then, it is impossible to deactivate the grid It does not happen with major or without the logscale The code to reproduce the problem import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot(range(100), range(100)) #If comment the following line everything is fine ax.set_xscale('log') xaxis = ax.get_xaxis() xaxis.grid(which = 'Minor') xaxis.grid(False) plt.show() Thanks Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] get parent or child from twinx() or twiny()
Hello everybody This is my first post to the list. To the point. I want to access the all the axes located where a mouse event occurred. My first try is with button_release_event The event will include inaxes, so I know the axes where the mouse event occurred. This is fine if at that location I have only one axes. If I have a twinx or twiny I only get the axes with the biggest zorder. The example: import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot(range(100),range(100)) ax1 = ax.twinx() plt.show() The question Having either ax or ax1 is it possible to find the other? In other words, from a given axes instance, is it possible to know which other axes share the same xaxis or yaxis? Thanks Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin -- -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users