Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Graph editor: Change order of subgraphs in bygraph ? |

Date |
Sat, 20 Aug 2011 08:56:45 +0200 |

Thanks again. This is really helpful. But actually I find your "hacking"methods more appeling as I do not need the "original" syntax to recreate the graphs (although it can be found in the .gph file). I tried to write a .gph parse command in Stata to switch bygraphs by changing the .gph file, which worked fine for producing the actual file, but the binary content bit me - so the resultant file was useless :-) I guess one could combine toyr to approaches..... BW, Jesper Scott wrote: I remember reading in Kit Baum's "An Introduction to Stata Programming" that *.gph files were actually programs to reproduce the graph. Looking back at section "10.5 Extracting data from graph files' sersets" shows that there is an easier way: //create original graph sysuse sp500,clear xtile g= date, n(4) twoway bar change date , by(g, rescale ) xlabel(, labsize(*.7)) graph save Graph "C:\Documents and Settings\scott.merryman\Desktop\Graph.gph",replace //extract data from graph cd "C:\Documents and Settings\scott.merryman\Desktop\" clear* serset clear graph use "Graph.gph" serset dir serset forv i = 0/`=r(id)' { serset set `i' serset use gen group = `=`i'+1' save temp`i'.dta,replace local files "`files' temp`i'.dta " } clear append using `files' clonevar gr2 = group replace gr2 = 4 if group == 1 replace gr2 = 1 if group==4 label define group 1 "4" 2 "2" 3 "3" 4 "1" label value gr2 group twoway bar change date , by(gr2, rescale ) /// xlabel(, labsize(*.7)) name(graph_new,replace) Hope this helps, Scott * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Graph editor: Change order of subgraphs in bygraph ?***From:*"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk>

**Re: st: Graph editor: Change order of subgraphs in bygraph ?***From:*Scott Merryman <scott.merryman@gmail.com>

**RE: st: Graph editor: Change order of subgraphs in bygraph ?***From:*"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk>

**Re: st: Graph editor: Change order of subgraphs in bygraph ?***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**st: Gen Randomized geo coordinates within a range** - Next by Date:
**st: AUTO: Monique van den Broek is out of the office. (returning 29-08-2011)** - Previous by thread:
**Re: st: Graph editor: Change order of subgraphs in bygraph ?** - Next by thread:
**st: Outreg2 and R^2 in a column next to variables** - Index(es):