Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Label for grouped plots


From   "Allan Reese AFH CEFAS" <[email protected]>
To   "'Statalist (E-mail)" <[email protected]>
Subject   st: Label for grouped plots
Date   Wed, 27 Apr 2005 16:08:29 +0100

A common requirement for publication is to show sample sizes on graphs.  Here is an approach that might be adaptable to various types of graphs.  Groupvar in the following is a string contained the group labels.

egen samplen = count(plotvar), by(groupvar)
gen labwithn = groupvar + " (" + string(samplen) + ")"
graph hbox plotvar, over(labwithn)t2("(sample size in brackets)")

With the added ability to exclude small samples, sort on sample size etc:
graph hbox plotvar if(samplen>10), over(labwithn)


Allan


***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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