Re: Re: Mathematica 6 Graphics Options
- To: mathgroup at smc.vnet.net
- Subject: [mg82908] Re: [mg82883] Re: Mathematica 6 Graphics Options
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sat, 3 Nov 2007 03:22:25 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <f1s1t6$fi3$1@smc.vnet.net> <200711020830.DAA16104@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Of course this code does not ensure one is actually clicking points "on" the graph -- if it's the graph of a function, or of several functions, that constitutes the graphic used as argument. One is merely clicking points somewhere in the image region and trying to get them to look as if they were "on" (or very close to) the actual graph. On the other hand, this function records coordinates for any sort of 2D graphic, not just from a Plot-like object. Joseph T. DeWitte, Jr. wrote: > Daniel, > > Here's a function I wrote that seems to solve the problem. > > clickCoordinateList[g_Graphics]:= > DynamicModule[{pts={}}, > Column[{ > ClickPane[ > Dynamic@Show[g,Graphics[{Black,Point/@pts}]], > (pts=Append[pts,#])& > ], > StyleForm[ > "\nStart clicking on the graph above. The list below will grow, \ > with one new x-y coordinate pair for each click. When you're done, \ > highlight the list from just before the first brace to just past the \ > last one. Next, use Edit/Copy on the front end menu bar to put the \ > list on the clipboard. Then you can Edit/Paste the list into a new \ > input cell for further manipulation. If you highlight much beyond \ > the list, you'll just get a string with the name of the internal \ > coordinate list variable (pts$$) when you paste into a new cell, \ > rather than the coordinates themselves. \n\n You may find it \ > useful to copy this function into the init.m file in the \ > $UserBaseDirectory/Kernel subdirectory so it's available every \ > time you start Mathematica.\n", > FontFamily->"Helvetica",FontSize->12, > FontWeight->Bold,FontColor->Red > ], > Dynamic[pts] > }] > ] > > Here's an example of how to use this function: > > gMyGraph=Plot[Sin[x]/x,{x,-10,10},GridLines->Automatic,Frame->True] > clickCoordinateList[Show[gMyGraph,ImageSize->500]] > > pastedPoints=**** paste list from above here ****; > deltas=Rest[pastedPoints]-Most[pastedPoints]; > approximatePathLength=Plus@@(Sqrt[#.#]&/@deltas) > > ---Joe DeWitte > > > > dh wrote: >> Hello All, >> >> In Mathematica 5 you could Option-Click into a 2D graphics and the coordinates >> >> of the cursor were displayed at lower left of the windows. By Ctrl-C you >> >> could even copy the coordinates to the clipboard. I am searching for >> >> quit some time in vain for an equivalent feature in Mathematica 6. Does anybody >> >> know if there is a replacement. >> >> Daniel Huber >> >> >> > -- 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: Mathematica 6 Graphics Options
- From: "Joseph T. DeWitte, Jr." <nnesita@xemaps.com>
- Re: Mathematica 6 Graphics Options