Search
   >> Home >> Resources & support >> FAQs >> Stata 7: Converting graphs to color .wmf format
This FAQ is for users of Stata 7. It is not relevant for Stata 8.

Stata 7: How can I convert a Stata graph to .wmf (Windows metafile) format and preserve the color?

Title   Stata 7: Converting graphs to color .wmf format
Author Shannon Driver, StataCorp
Date January 2002

There are three ways to obtain a .wmf format graph in color. Two of these methods can be used while the graph is being displayed in the Graph window. For both of these methods, you should start by checking the selected scheme for the Graph2wmf translator.

 . translator query Graph2wmf
 -------------------------------------------------------------------------
                 scheme | monochrome                        |  
               fontface | Arial                             |  
 -----------------------+-----------------------------------+-------------
             usegphsize | on                            mag | 100
                  xsize | 6.00                         xmag | 100
                  ysize | 4.00                         ymag | 100
 -----------------------+-----------------------------------+-------------
                   resx | 300                          resy | 300
 -------------------------------------------------------------------------

To obtain a color .wmf file, you will need to change the scheme to something other than monochrome. Black background, white background, or any of the three custom backgrounds will work just fine. I will use the black background (blackbg) scheme in this example.

 . translator set Graph2wmf scheme blackbg

 . translator query Graph2wmf
 -------------------------------------------------------------------------
                 scheme | blackbg                           |  
               fontface | Arial                             |  
 -----------------------+-----------------------------------+-------------
             usegphsize | on                            mag | 100
                  xsize | 6.00                         xmag | 100
                  ysize | 4.00                         ymag | 100
 -----------------------+-----------------------------------+-------------
                   resx | 300                          resy | 300
 -------------------------------------------------------------------------

The first method is to click File and then Save Graph. This will bring up a "Save Stata Graph File" dialog window. In this window, you will need to navigate to the directory where you wish to save the graph. Next enter a filename and select Windows Metafile (*.wmf) in the drop-down list next to Save as type:. After that, you can click on Save to save the graph.

The second method is to use the translate command with the Graph2wmf translator.

        . translate @Graph mygraph.wmf
The third method of obtaining a color .wmf graph is used when the graph is already saved as a .gph (Stata graph) file. The steps for this would be almost identical to those for the Graph2wmf translator, only here you will use the gph2wmf translator. Here are the commands you would use:
 . graph mpg weight, saving(mygraph.gph)

 . translator query gph2wmf
 -------------------------------------------------------------------------
                 scheme | monochrome                        |  
               fontface | Arial                             |  
 -----------------------+-----------------------------------+-------------
             usegphsize | on                            mag | 100
                  xsize | 6.00                         xmag | 100
                  ysize | 4.00                         ymag | 100
 -----------------------+-----------------------------------+-------------
                   resx | 300                          resy | 300
 -------------------------------------------------------------------------
 
 . translator set gph2wmf scheme blackbg
 
 . translator query gph2wmf
 -------------------------------------------------------------------------
                 scheme | blackbg                           |  
               fontface | Arial                             |  
 -----------------------+-----------------------------------+-------------
             usegphsize | on                            mag | 100
                  xsize | 6.00                         xmag | 100
                  ysize | 4.00                         ymag | 100
 -----------------------+-----------------------------------+-------------
                   resx | 300                          resy | 300
 -------------------------------------------------------------------------

 . translate mygraph.gph mygraph.wmf
The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ Watch us on YouTube