graph export — Export current graph 3
as(fileformat) specifies the file format to which the graph is to be exported. This option is rarely
specified because, by default, graph export determines the format from the suffix of the file
being created.
replace specifies that it is okay to replace filename.suffix if it already exists.
override options modify how the graph is converted. See [G-3] ps options, [G-3] eps options,
[G-3] svg options, [G-3] pdf options, [G-3] png options, [G-3] tif options, [G-3] gif options,
and [G-3] jpg options. See also [G-2] graph set for permanently setting default values for the
override options.
Remarks and examples stata.com
Graphs are exported by displaying them on the screen and then typing
. graph export filename.suffix
Remarks are presented under the following headings:
Exporting the graph displayed in a Graph window
Exporting a graph stored on disk
Exporting a graph stored in memory
If your interest is simply in printing a graph, see [G-2] graph print.
Exporting the graph displayed in a Graph window
There are three ways to export the graph displayed in a Graph window:
1. Right-click on the Graph window, select Save Graph..., and choose the appropriate Save as
type.
2. Select File > Save Graph..., and choose the appropriate Save as type.
3. Type “graph export filename.suffix” in the Command window. Stata for Unix(GUI) users
should use the name() option if there is more than one graph displayed to ensure that the
correct graph is exported (see Technical note for Stata for Unix(GUI) users).
All three are equivalent. The advantage of graph export is that you can include it in do-files:
. graph . . . (draw a graph)
By default, graph export determines the output type by the suffix. If we wanted to create an
Encapsulated PostScript file, we might type
. graph export figure57.eps
Exporting a graph stored on disk
To export a graph stored on disk, type
. graph use gph_filename
. graph export output_filename.suffix
Do not specify graph use’s nodraw option; see [G-2] graph use.