Naming and Saving Graphs
If several graphs are created in one session, it may be helpful to give names to them (e.g., to refer to them later on). This is accomplished with the help of the "name" option.
kdensity bk_nk_w , name(NK_W, replace)
The replace option within the name option prevents Stata from stopping if you already created this graph and now want to create a modified version. As it will do no harm if the graph is not already present, you might as well use this option from the beginning, not having to think about it later on. (Of course, this holds true only if you're sure you don't want to keep the old file!)
Names are also needed to save graphs in a format that can be further processed by other software.
graph export NK_W.wmf, replace
will save the graph in Windows Metafile format (if you are working under Windows). Other formats are available; the best way to create a graph in a certain format is to give the file the appropriate extension.
graph export NK_W.ps |
Postscript |
graph export NK_W.eps |
Encapsulated Postscript |
graph export NK_W.emf |
Windows Enhanced Metafile |
graph export NK_W.pict |
Macintosh Pict format |
graph export NK_W.pdf |
PDF format (prior to version 12 available on Macintosh only) |
graph export NK_W.png |
PNG (Portable Network Graphics) |
graph export NK_W.tif |
TIFF format |
© W. Ludwig-Mayerhofer, Stata Guide | Last update: 30 Jun 2014