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 |
Phil Schumm <pschumm@uchicago.edu> |

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

Subject |
Re: st: adding different text to each of a set of graphs |

Date |
Fri, 26 Apr 2013 15:53:59 -0500 |

On Apr 26, 2013, at 2:30 PM, richgold@ix.netcom.com wrote: > I am producing a set of line graphs (e.g., via -twoway line o time, by(id)-) and I want to add the value of a fourth variable as a "note" (or other form of text) to each of the graphs; is this possible? if yes, how? There are probably better ways to do this, but one approach would be tempvar obs gen `obs' = _n qui levelsof id, loc(ids) foreach id of loc ids { qui sum `obs' if id==`id' line o time if id==`id', t1title(`id') note(`"`=note[`r(min)']'"') /// name(p`id', replace) loc plots "`plots' p`id'" } gr combine `plots', ycommon xcommon note("Graphs by id") As you can see, this assumes that the var id is numeric and that the value of note (i.e., your 4th variable) is constant within unique values of id. Note that the graph this generates will not look *exactly* like that you get with the -by()- option, but you can make it so with a few additional graph options if you'd like. -- Phil * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: adding different text to each of a set of graphs***From:*richgold@ix.netcom.com

- Prev by Date:
**Re: st: simulated value of a ratio does not compare to manually calculated value** - Next by Date:
**Re: st: ladder question for right-skewed variable** - Previous by thread:
**st: RE: adding different text to each of a set of graphs** - Next by thread:
**Re: st: adding different text to each of a set of graphs** - Index(es):