A very simple .m
file to read a .fig
file and plot it in Octave.
This file was recovered from a deleted Stack Overflow post, referenced in a LaTeX forum here. This code in turn was based on another file which is no longer available on the internet but is reproduced here. The original page is here on the internet archive, but the original .m
file was not archived.
The original authors are acknowledged in the header comment.
Unpacks the struct that is stored in the .fig
file (which is a specialisation of the .mat
format). Detects lines, scatter plots, surface plots within the struct as well as textual elements.
Quote from the author who expanded the original:
an expanded version I built based on Cibby's code above. This one includes features such as subplots, markers and marker sizes, scatter plots, text, patches, surfaces, and legends:
fname = "/path/to/my/figure.fig"
OpenMatlabFigureInOctave(fname)
Contributions are welcome - just send in a pull request.
You might want to extract the data and plot in another language / save in a different format. There are instructions for unpacking using Python on this Stack Overflow answer