Retrieving and Combining Graphs by using Stata

Any graph saved in Stata’s “live” .gph format can subsequently be retrieved into memory by the graph use command. For example, we could retrieve Figure 3.26 by typing

. graph use fig03_26.gph

Once the graph is in memory, it is displayed onscreen and can be printed or saved again with a different name or format. From a graph saved earlier in .gph format, we could subsequently save versions in other formats such as Encapsulated PostScript (.eps), Portable Network Graphics (.png) or Enhanced Windows metafile (.emf). It is also possible to change the color scheme, either through menus or directly in the graph use command. fig03_26gph was saved in Stata’s s2color scheme, but we could see how it looks in s2monochrome (which substitutes dashed lines for different colors) by typing

. graph use fig03_45.gph, scheme(s2mono)

Graphs saved on disk can also be combined by the graph combine command. This provides a way to bring multiple plots into the same image.

The do-file below (saved as fig03_27.do, then run by typing do fig03_27) combines Figures 3.17, 3.18 and 3.19 from this chapter. The /// indicates a command continued on the next physical line, as described earlier. The final combined image is saved as Figure 3.27.

The rows(2) option specified that Figure 3.27 should be arranged with the sub-graphs in two rows. Equivalently, we could have specified col(2). altshrink calls for alternate scaling of the text within each small image. Note that we can request an overall title (or note, caption, ytitle, xtitle and so forth — not shown) for the combined image. However, we cannot substantially change contents of the sub-graphs themselves.

Source: Hamilton Lawrence C. (2012), Statistics with STATA: Version 12, Cengage Learning; 8th edition.

1 thoughts on “Retrieving and Combining Graphs by using Stata

  1. marizonilogert says:

    My brother suggested I may like this blog. He was once totally right. This submit truly made my day. You cann’t believe simply how much time I had spent for this information! Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *