How to extract data from a MATLAB figure
If you still have the .fig file, the data is inside it and MATLAB will hand it back. When all that is left is the figure in a paper, this reads it from the PDF.
If you have the .fig file
Open it without showing it and ask each line for its data: fig = openfig('name.fig', 'invisible'); h = findobj(fig, 'Type', 'line'); x = get(h, 'XData'); y = get(h, 'YData'). That is exact and needs no digitizer.
If you have only the PDF
- Drop in the paper's PDF, or the figure's own PDF.
- Each line comes back with its markers as one series, under its legend name.
- Check the rings drawn on the figure, then download Excel or CSV.
What we measured
- On figures MATLAB made, from 29 recent papers the reader had never seen: of 31 plain line and bar charts, 28 were read, and both axes held the printed numbers on 27 of those.
- Every detail right (kind of chart, axes, number of series and every legend name) on 14 of the 31. Crowded figures with arrows and notes drawn on them come out with too many series: check those against the picture.
- Charts drawn by GNU Octave from data we know and saved as PDF: 56 of 56 read correctly.
Limits
A legend set with MATLAB's LaTeX interpreter is stored as drawn shapes, not as text. The lines are still read, but their names cannot be, so they come back unnamed and the result says so.
Three-dimensional plots are refused: a point in one cannot be read off two axes.
An Octave figure saved as EPS holds its axis numbers as shapes too. Save it as PDF instead, or drop in a screenshot to have it read as a picture.
Questions
Does it read .fig or .mat files?
No. Those hold the data itself, and MATLAB reads them directly, as shown above. This is for when only the published figure is left.
Is it free?
Reading a figure from a PDF is free and unlimited.