print

Trick and treats

Digitizing plot figures

The goal here is to get a table of X, Y values from files containing one or more plots. We address here two cases using macOS tools but Windows and Linux users can easily find equivalents:

  • plots available in the form of a vectorial drawing (i.e. the elements of which can be edited with Illustrator) stored in .eps or .pdf files. Please jump to point 2 below.
  • plots available only in the form of a bitmap image (i.e. which cannot be edited with Illustrator). In that case a cumbersome manual data capture must be performed which is greatly facilitated by softwares such as IGORThief, DataThief, WebPlotDigitizer, etc. However the latter might not be suitable e.g. if a large magnification is necessary for an accurate enough data capture, hence the trick below.

1- Bitmap

  1. With PhotoShop or équivalent make sure the X and Y axes are horizontal and vertical. Rotate, skew or distort if necessary.
  2. Import the bitmap image in Illustrator. You may lock it to make the following easier.
  3. select the pen tool and click once each point of the plot.
    Caution, do not move the cursor while clicking since this would add Bézier handles.
    Note that you can zoom and scroll the image to make the point clicking much more accurate and easy
  4. unlock and delete the background image and export the curve at the .eps format. The plot is now vectorial.

2- Vectorial drawing

  1. import the .eps file to Preview.app
  2. select Print and use the bottom left menu to export the file to the .ps format. This performs a binary to ascii conversion.
  3. open the .ps file with a text editor such as TextMate.app, BBedit.app or even TextEdit.app is set to the its "Plain text" mode
  4. search the .ps file content for the table of X,Y coordinates
  5. copy/past to TextEdit.app (plain text mode) and replace spaces by tabs
  6. you can now import those data to Excel.app, Kaleidagraph.app, Igor.app, Fityk.app, etc.
  7. of course you will have to manually scale the axes but this nothing more than a rule of three.