Re: Get Graphics Coordinates accuracy

*To*: mathgroup at smc.vnet.net*Subject*: [mg92308] Re: Get Graphics Coordinates accuracy*From*: "David Park" <djmpark at comcast.net>*Date*: Sat, 27 Sep 2008 06:50:36 -0400 (EDT)*References*: <gbflnv$682$1@smc.vnet.net>

John, Before WRI reintroduced the GetCoordinates button in the DrawingTools Palette in Version 6, I included commands to perform a similar operation with the Presentations package. The user can apply a LocatorDraw or LocatorLine[n] expression to a drawing statement and then obtain a display showing the positions of the locators in the plot. These positions can then be copied and pasted, even back into the plot if you want to add a Text statement say. Then the LocatorDraw or LocatorLine[n] can be removed. So here is your example done with Presentations. Needs["Presentations`Master`"] LocatorLine[2]@ Draw2D[ {Draw[Sin[2 x], {x, 20270, 20275}]}, Frame -> True, ImageSize -> 400] (* graphic with two locators connected by a line, then adjusted to the peaks *) Line[{{20270.3,0.98},{20273.5,0.999999}}] When the points are copied out of the Line expression they give full precision. {{20270.345`,0.98`},{20273.515`,0.9999992007707353`}} The GetCoordinates mechanism is convenient for many purposes but it has four disadvantages of various degrees of severity. Least severe is that if you copy only one point it has double brackets and for most uses you will have to hand edit one pair of brackets out. Next is the problem you mention - that it returns truncated precision. A third problem is that you have no chance to adjust the points you want before copying. With locators you can see and adjust what you have before copying. A fourth problem is the whole concept of using Drawing Tools to edit a graphic. (But perhaps that is not what you are doing in this particular case.) With Presentations one can have a Draw2D statement with many elements in it: curves drawn by different methods and various primitives and directives. Now if you edit this with Drawing Tools, say to add some points or a text label, you end with a second amended specification of the graphic, which is in graphic form. Now suppose you wish to add something else to the graphic that is not included in the Drawing Tools palette, say another computed curve. You have to go back to the original statement. You have then lost all the editing you did with Drawing Tools - and even worse there is no textual record of what you did. It is much better, and more professional, to have a single statement, in StandardForm say, that completely defines the graphic. Your actual problem sounds like one that might benefit from a dynamic display, that might have a movable point restricted to the curve and would also have a dynamic display of the coordinates, or slope or other computed quantities. -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "John Jowett" <John.M.Jowett at gmail.com> wrote in message news:gbflnv$682$1 at smc.vnet.net... >I came across a limitation in the mechanism for copying coordinates of > points in 2D graphics (the Get Coordinates button in the Drawing Tools > palette) in V6.03. > > Consider the following plot of a sine wave > > Plot[Sin[2 x], {x, 20270, 20275}] > > When I try to select and paste the coordinates of the two crests of > the wave, I typically get two points with the same x-coordinate > > {{2.027*^4, 0.99}, {2.027*^4, 0.99}} > > whereas I would expect the two x-coordinates to be around > 20270.3 and 20273.5, values which are well separated on the plot. > > This seems to happen because the Get Coordinates function only returns > the first 4 digits of the coordinates. > > Does anyone know of a way to fix this ? Obviously, in this > demonstration example, I could change variables to x1=x-20270 but in > the more complicated problem I am working on, this is not so easy. > > John Jowett >

**Re: Help**

**How to debug init.m?**

**Get Graphics Coordinates accuracy**

**Re: Get Graphics Coordinates accuracy**