For instance, suppose we had a graph from a technical paper, and we wanted to extract numerical data from the graph lines. One way would be to measure the points by hand and calculate the numbers by scaling from the axes, but that would be inaccurate, error prone and tedious. Another way would be to scan the graph and paste it into a program that will return the screen coordinates of selected points, and scale the screen coordinates to graph coordinates. I have written a VBA program to make this procedure quick and easy: DigitGraph.xls (including full open source code).
The procedure is:
- Paste the scanned image, and drag to a convenient size.
- Select the rectangle named “Axes”:
- Drag the rectangle so the bottom left corner is at the origin.
- Stretch the top right corner so that the left and bottom edges extend to points with known ordinates.
- Draw over the lines or shapes to be digitised, using a single freeform shape for each line.
- Give the drawn shapes any unique name.
- Enter the Digitgraph function as shown below, where XLen and YLen are the true length of the X and Y axes.
- If the origin has non-zero coordinates enter Xorigin and Yorigin.
- Enter the function as an array function: Select the output range, press F2, then press Ctrl-Shift-Enter
The function arguments are: =DigitGraph(Shape Name, XLen, YLen, Xorigin, Yorigin)
The function will return a list of coordinates of the traced lines, to the scale of the X and Y axes.
Example output is shown in the screen shot below, using a scanned graph of a beam deflection experiment. The DigitGraph function results are on the right, showing the number of points in the traced polyline, followed by XY coordinates, to graph scale, for each point.