MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Reading Coordinates from Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80120] Re: [mg80085] Reading Coordinates from Plot
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 13 Aug 2007 04:30:10 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200708121115.HAA27714@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Evidently you joined the discussion about this later than many who 
encountered the same problem with 6.0. The lack of that 5.2 
functionality is no doubt necessitated by the addition in 6.0 of all 
sorts of behavior governed by mouse click/key combinations.  Yet it's a 
functionality that's hard to duplicate and seems to require code going 
well beyond Manipulate.

Search the MathGroup archives and you'll find several workarounds for 
this.  You can find one thread by "Locator question", but other ways 
were proposed.

The following code, based upon some posts of "Albert" to that thread, 
allows you to click points ONLY on the graph of the function and see the 
coordinates of that point below the plot, where from which you can copy 
the current coordinate pair and paste it elsewehere. Unfortunately, as 
it stands it does not allow you to produce all at once, and hence to 
copy, all the points you've clicked.

   trackPointOnPlot[f_,{a_,b_},strt_: Automatic]:=
     Module[
       {start=strt/.Automatic->a},DynamicModule[{p={start,f[start]}},
       Column[{
         LocatorPane[Dynamic[p,(p={First@#,f[First@#]})&],
           Plot[f[x],{x,a,b}]],
         Dynamic[p]
       }]
     ]
   ]

   (* examples to try *)

   trackPointOnPlot[Cos,{0,10},Pi]
   trackPointOnPlot[Cos,{0,10}]

jrc wrote:
> Hello,
> 
> Apparently v6.0.1 no longer has the mouse functionality that
> enables one to easily read coordinates from a plot. In v5.2
> and before (as mentioned in several books such as Navigator),
> one could select the plot by clicking on it, then hold down
> CTRL key and move the mouse to read coordinates. In v6.0.1
> this does not work. Nor can I find any equivalently convenient
> functionality.
> 
> This is one example, by the way, of the deficiencies of the new
> "Help" system. It seems to provide an entry only into a list of
> Mathematica symbols, with very little guidance as to what
> functionality is available. Searching under many combinations
> of 'mouse', 'plot', and even 'read coordinates', I see nothing
> useful except oblique references to the new 'manipulate' function.
> 
> Looking under 'manipulate' documentation brings one to a complicated,
> new system, which takes time to digest. In a short look (half hour)
> I find nothing relevant to reading coordinates from a plot. The
> Dynamic MousePosition function seems to get partway there, but seems
> only to output screen coordinates - not very useful. Is it really
> necessary to go to this obtuse new system to regain the easy reading
> of coordinates via mouse???
> 
> John Chaffer
> 

-- 
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


  • Prev by Date: Re: Mathematica v5 versus v6
  • Next by Date: Re: question in mathematica
  • Previous by thread: Reading Coordinates from Plot
  • Next by thread: Re: Reading Coordinates from Plot