Stata 11 help for graph_export

help graph export -------------------------------------------------------------------------------

Title

[G] graph export -- Export current graph

Syntax

graph export newfilename.suffix [, options]

options description --------------------------------------------------------------------- name(windowname) name of Graph window to export as(fileformat) desired format of output replace newfilename may already exist override_options override defaults in conversion ---------------------------------------------------------------------

If as() is not specified, the output format is determined by the suffix of newfilename.suffix:

implied suffix option output format --------------------------------------------------------------------- .ps as(ps) PostScript .eps as(eps) EPS (Encapsulated PostScript) .wmf as(wmf) Windows Metafile .emf as(emf) Windows Enhanced Metafile .pdf as(pdf) PDF .png as(png) PNG (Portable Network Graphics) .tif as(tif) TIFF other must specify as() --------------------------------------------------------------------- ps and eps are available with all versions of Stata; png and tif are available for all versions of Stata except Stata(console) for Unix; wmf and emf are available only with Stata for Windows; and pdf are available only with Stata for Mac.

override_options description --------------------------------------------------------------------- ps_options when exporting to ps eps_options when exporting to eps tif_options when exporting to tif png_options when exporting to png ---------------------------------------------------------------------

There are no override_options for the pdf format.

Description

graph export exports to a file the graph displayed in a Graph window.

Options

name(windowname) specifies which window to export from when exporting a graph. Omitting the name() option exports the topmost graph (Stata for Unix(GUI) users: see Technical note for Stata for Unix(GUI) users). The name for a window is displayed inside parentheses in the window title. For example, if the title for a Graph window is Graph (MyGraph), the name for the window is MyGraph. If a graph is an asis or graph7 graph where there is no name in the window title, specify "" for windowname.

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] ps_options and [G] eps_options. See also [G] graph set for permanently setting default values for the override_options.

Remarks

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] 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)

. graph export filename.suffix (and export it)

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] graph use.

Stata(console) for Unix users: follow the instructions just given, even though you have no Graph window and cannot see what has just been "displayed". Use the graph, and then export it.

Exporting a graph stored in memory

To export a graph stored in memory but not currently displayed, type

. graph display name

. graph export filename.suffix

Do not specify graph display's nodraw option; see [G] graph display.

Stata for Unix(console) users: follow the instructions just given, even though you have no Graph window and cannot see what has just been "displayed". Display the graph, and then export it.

Technical note for Stata for Unix(GUI) users

X-Windows does not have a concept of a window z-order, which prevents Stata from determining which window is the topmost window. Instead, Stata determines which window is topmost based on which window has the focus. However, some window managers will set the focus to a window without bringing the window to the top. What Stata considers the topmost window to Stata may not appear topmost visually. For this reason, you should always use the name() option to ensure that the correct Graph window is exported.

Also see

Manual: [G] graph export

Help: [G] ps_options, [G] eps_options, [G] png_options, [G] tif_options; [G] graph set, [G] graph display, [G] graph use; [G] graph print


© Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index