Re: Re: Reading Coordinates from Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg80188] Re: [mg80135] Re: Reading Coordinates from Plot
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Tue, 14 Aug 2007 07:10:40 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <f9mqlv$ri0$1@smc.vnet.net> <200708130837.EAA27841@smc.vnet.net>
- Reply-to: murray at math.umass.edu
I tried the same thing, in 3 separate Input cells, but with a Plot instead of a ListPlot: res={}; Dynamic[res] EventHandler[ Plot[Sin[x],{x,0,Pi}],{"MouseUp":>AppendTo[res, MousePosition["Graphics"]]} ] However, at each mouse click-release it's tricky not to get that point's coordinates appearing twice in the list. I think that "MouseDown" might be better there. This is a promising technique. Now to encapsulate it in a function that can be passed any 2D graphics.... rxm at inbox.com wrote: > ::::::::: On Aug 12, 7:24 am, jrc <jrch... at mcn.net> wrote: > : > : Apparently v6.0.1 no longer has the mouse functionality that > : enables one to easily read coordinates from a plot. <...deleted...> > > I also missed the ability to read the data from plots. Here > is a cheap way to read mouse clicks > > data = Table[RandomReal[], {10}]; > > res = {}; > > Dynamic[res] > > EventHandler[ > ListPlot[data], {"MouseUp" :> AppendTo[res, > MousePosition["Graphics"]]} > ] > > Enter each line in a different cell of the notebook. > > Now, whenever you release the mouse button inside the plot > area the output cell of Dynamic[res] will be updated with > the position of the click. > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Re: Reading Coordinates from Plot
- From: rxm@inbox.com
- Re: Reading Coordinates from Plot