Re: Digitizing a graph/plot
- To: mathgroup at smc.vnet.net
- Subject: [mg8679] Re: [mg8628] Digitizing a graph/plot
- From: seanross at worldnet.att.net
- Date: Mon, 15 Sep 1997 02:49:06 -0400
- Sender: owner-wri-mathgroup at wolfram.com
SESSELMANN ROLAND wrote: > > I have a graph stored as a graphics file (i.e. JPG) and would like to > digitize it. > > In Mama one can click on the graph, hold down the ALT key, and move the > mouse cursor around to see the coordinates. This works fine. > > Is there a way to directly copy specific coordinates i.e. into the next > input line rather than only seeing these coordinate (lower left corner > of the notebook) and have to type them in by hand for further use? > > Here is the "big picture" of what I want to do: > > I found a figure in a paper which contains a plot of a function. > Unfortunately the functional form is not given so I have to pick a few > points of the function and do a curve fit to get a functional form. There > are many possibilities to do this, i.e. using a pencil and a ruler or > writing a sophisticated image processing program. For my purposes I need > something in between. What I did is I scanned in the figure i.e. as a JPG > file, open it with Mama, found the coordinates of points along the > function, typed in the coordinates by hand again and did a curve fit > (using appropriate scale factors to match the coordinate systems). > > Does someone have an idea of how to simplify this process preferably with > Mama but also other programs? (I do not like the "typing in by hand" > part ...) I am using Mama 3.0 and 2.2 on all platforms (Unix, Linux, W95, > Mac). > > Thank you! > > Roland Sesselmann > sesselma at engine.colorado.edu To automate the process, you need to get the data in digital, not graphic format. This is easily done with PaintShop Pro(jasc.com). You can convert the file to RAW, PGM or PPM and ReadList in data in. Then use the Position function to pick out the coordinates of all the graph pixels on the basis of a unique color or greyscale value. Then you could Fit or Interpolation the results to get something close to the original equation. If the graphic in question is already in Mma, then set it equal to a symbol and examine the various elements of the symbol. One of them is a huge list of RasterArray elements. That would be another way to get at the data. PS. We usally use Mma as an abbreviation for Mathematica. Mama as an abbreviation seems oedipal.