8
$\begingroup$

I would like to know how to extract data from plots in a paper and, also, how to do that in a way that include error bars. I know there are specific softwares to do that, e.g. Plot Digitizer, which also work for scanned graphs. But I want to "digitize" inside Mathematica, so I don't need external softwares.

Furthermore, the plots in a paper can be a bit polluted. An example of a graph to digitize follows below. The desired points are the black points including error bars.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Take a look at this: mathematica.stackexchange.com/q/3831/685 $\endgroup$ – VLC Feb 26 '13 at 16:49
  • $\begingroup$ Providing a solution for a particular family of graphs is expensive, but a general solution is priceless $\endgroup$ – Dr. belisarius Feb 26 '13 at 17:41
7
$\begingroup$

In general, the problem is that error bars are plotted using different symbolic conventions in different texts, so the automatic extraction would have to be tailored somewhat to each case. An easier approach is to embed the plot into a Graphics frame using Inset, and then use the drawing tools to capture the coordinates you need by hand.

Here is a less automated but more flexible way to get data from a plot:

dataPlot = Import["http://i.stack.imgur.com/hoeHR.jpg"];

Manipulate[
 Graphics[{}, PlotRange -> {{10, 110}, {0, 1}}, Frame -> True, 
  AspectRatio -> 1/GoldenRatio,
  Prolog -> 
   Inset[Show[dataPlot, AspectRatio -> Full], 
    p, {Center, Center}, {w, h}]
  ],
 {{p, {Center, Center}}, Locator}, {w, 60, 130}, {h, .5, 2}]

dataplot

Here, I can now use the Locator to drag the image around inside the frame of the Graphics. The sliders let me adjust the width and height of the plot until the frame labels coincide on both axes.

To extract the data from this, click the plus sign at the top right to reveal the menu where you can select Paste Snapshot. Do this and evaluate the result to get a snapshot of the framed plot.

Now click on the plot to highlight it, followed by . to see the coordinate tool. Prsse Cmd-c to start copying the coordinates you click. In this way you can assemble the desired data sets.

$\endgroup$
  • $\begingroup$ Beautiful! I just used it very effectively. It turns out you can click and lay all the points, then Ctrl-C copies the line. $\endgroup$ – Nicholas G Nov 5 '16 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.