[Matplotlib-users] "unpick"
Folks, Is there a way to "unpick" data that was previously "picked"? The issue is that pick, is very precise. I cannot depend on a identical click, in the exact same location, to create the "unpick" tool and behavior that I am looking for. It occurs to me that it is possible to create an "unpick" event by creating a matrix of data that surrounds the unpick location and then if the picked data point is within this matrix of data, I can process and remove the originally picked point from the location I am storing the original pick locations. Maybe Pygame or a collision tool might work also, but I have to study to find out. Is there another preferred way that you see? or can recommend? Thank You and Best Regards, Michael Frauens -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] location of from pylab import * effects Tk widgets keyword=text
Wasn't sure where to post this so I'll keep it brief (and I have tried to check forums, FAQ and guides) I'm a relative noob but have a Tk based GUI running properly and have used Matplotlib successfully in two separate implementations of code. When I try to combine my GUI code with my matplotlib code and then place a "from pylab import *" into my code, I run into problems with the GUI widgets "text" variable "not being expected". This is before I execute any specific features of pylab. If I move the import down in my code, after the GUI classes I have created have exited their mainloop, I have no problem. It seems as if execution of the pylab import interferes with the Tk widgets "text" keyword somehow. I would prefer to execute my matplotlib "code" iteratively from inside of my gui (as the user picks different data sets and so forth) and not have the program exit my mainloop GUI environment to then plot independently using matplotlib. The pieces work fine, but it is odd to me that the location of where I place the import determines the success of execution of my code. Perhaps there is some important information about Tk running a mainloop and importing pylab at the same time that I do not understand. (I normally execute from double click on the filename.py) I can share the code and the rc file but wanted to make sure I was in the right post location first. Apologies if I misunderstood FAQ direction for problem review. Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] backend_bases.MouseEvent / event.inaxes or ? for new figure from a subplot
I am trying to generate a separate, large plot, from a click on a single smaller subplot that is one of 8 plots in a figure I generate. I am generating the 8 plots fine and can "capture" event.inaxes and/or event.canvas instances but they only refer to a location. How do I use this location (or something else) to replot the information from the physically small sized subplot to a larger plot that I want the user to be able to see? Other constraints/issues: + I did see a discussion thread on using keys and "f" for a full screen view of??. However, the start of the thread was not clear to me and I was not sure how to get started. Is there an example or method that I can use that would give me such a full screen view from a subplot using "f"? This probably serves my purposes. + I am a newbie to python and have a mix of OO code with classes and older procedural code (from my Fortran days). I am still adjusting to how to create classes and use them effectively so if this is the solution path, I may need more specifics than normal. + I prefer to use version 0.90 because of a "new" issues with .91.1 and py2exe I am trying to work out/understand. Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] mpl event backend; replotting a subplot (inefficient example improvement suggestions?)
I want to create an copy of a subplot in its unique figure after being clicked on in a figure with multiple subplots. My code seems to work but I believe is inefficient and I'd like to understand how to use the event.* information more effectively in mpl. I am successfully creating multiple subplots in a Figure using a class with lines for the data such as below. I create a new figure for each instance of the class with 8 subplots in each. exec("self.a.plot(glbl.%s0_pcdata,glbl.%s6_pcdata,glbl.%s0_pcdata,glbl.%s9_pcdata)"%(color,color,color,color)) Furthermore I am using a mpl_connect to successfully capture and then validate which instance of the Figure for each of the unique subplots clicked on. self.cid=self.canvas.mpl_connect('button_press_event', click) I want to use the event to make an alternate sized plot of the subplot chosen. I can do this through some modest logic where I use the event information identify the instance clicked on. A partial description of this logic is below - which seems to work properly. (a, b, c ... are subplots; Instances are Kfigure, Yfigure etc...) def click(event): print 'you clicked x,y', event.x, event.y print 'you clicked inaxes', event.inaxes print 'string name of event', event.name print 'figure canvas instance', event.canvas if event.canvas==Kfigure.canvas: print "K canvas clicked" if event.canvas==Yfigure.canvas: print "Y canvas clicked" if event.inaxes==Kfigure.a: print "clicked inside subplot a of figure K" However, to create an alternate "new" plot of the subplot I clicked, I have to create extended logic code (as above) for each of 40 subplots on 5 figures, and then reidentify the source data similar to the original exec line and shown below. This seems inefficient. Isn't there a more straightforward way to create the subplot clicked in its instances of "new" figure // sorry if my terminology is inexact.. noob // A section of my suspected inefficient code is below. Isn't there a way to use the event.inaxes, or other axes or data information to identify the data to be plotted and then subplot it? Ideally this should include legend information that was created with the instance as well - that is not explicitly shown but I have done. All I am really trying to do is enlarge one of the subplots for the user. In the example in this email, I simply want to have a large Kfigure.a created. I can get my code to work but it seems overly long and inefficient. if event.inaxes==Kfigure.a: print "clicked inside subplot a of figure K" color="K" bigroot=Tk.Tk() bigroot.wm_title("title with big wm_title") bigf=Figure(figsize=(3,6), dpi=72) biga=bigf.add_subplot(111) exec("biga.plot(glbl.%s0_pcdata,glbl.%s6_pcdata)"%(color,color)) bigcanvas=FigureCanvasTkAgg(bigf, master=bigroot) bigcanvas.show() bigcanvas.get_tk_widget().pack(side=Tk.TOP,fill=Tk.BOTH,expand=1) Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] delete instance of axvspan
I am using span selector to identify an area and then highlight in in green. I want the user to be able to validate this (or not) and then select another area (or not). However, when the user selects the alternate area I want the previous instance of axvspan to be deleted/removed. How do I remove this instance? of do I have to delete the whole plot and replot? Removing the instance is strongly preferred becauase the user may of altered the display using the canvas widgets. f=Figure(figsize=(12,8), dpi=72) a=f.add_subplot(111) ... a.plot(aTime, aDensity, 'k', aTime, aElec, 'b') ... canvas = FigureCanvasTkAgg(f, master=root) canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP) . def onselect(timemin,timemax): indmin,indmax=npy.searchsorted(glbl.act_time[glbl.newjob],(timemin,timemax)) indmax=min(len(glbl.act_time[glbl.newjob])-1,indmax) thistime=glbl.act_time[glbl.newjob][indmin:indmax] exec("thisDens=glbl.%s_d[%d][indmin:indmax]" % (newcolor, glbl.newjob)) exec("thisElect=glbl.%s_d[%d][indmin:indmax]" % (newcolor, glbl.newjob)) print thisDens #creates a reference green area to validate area chosen lo=glbl.act_time[glbl.newjob][indmin] hi=glbl.act_time[glbl.newjob][indmax] a.axvspan(lo,hi,facecolor='g',alpha=0.5) canvas.show() ... span=SpanSelector(a,onselect,'horizontal',useblit=True, rectprops=dict(alpha=0.5,facecolor='red')) Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users