Recover Stata code from .gph files

If you ever found a good looking Stata figure saved as Stata’s own .gph and wondered how this was produced, you can simply look up the code that is stored in the file’s meta data.

Move Stata to the directory in which the .gph file is stored in and write

gs_fileinfo mygraph.gph
di r(command)

This code will produce the full code used to create the figure in Stata’s results window

Leave a Reply