Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: labels on bar graphs


From   "Frank de Libero" <[email protected]>
To   <[email protected]>
Subject   st: RE: labels on bar graphs
Date   Sun, 29 Jun 2008 18:51:05 -0700

What follows may help you solve your particular problem. 

For a recent chart book for WA state legislature, there were numerous charts
that used code similar to:

//Calculate mean # bills passed and assign to local macros
//This is semi-automatic: There's no intervention needed for axis
//labeling, determining mean levels.
forval x = 1/2 {         //x represents chamber: 1 = Senate; 2 = House
     summarize passed if chamber==`x', meanonly
          local mean`x' = round(r(mean)) //eg, mean1 = mean of Senate
}

And then in the body of the chart commands:

ytitle("Number of bills passed") ylabel(0 `mean1' `=`mean1' - 73'
"(Avg)" 525, notick)

I'd then visually review all the charts and make adjustments if needed, but
generally the above worked well.

Perhaps with modification a similar approach would work for you.

..Frank


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Richard Goldstein
Sent: Sunday, June 29, 2008 1:53 PM
To: statalist
Subject: st: labels on bar graphs

Hi:

I need to produce a sizable number of bar graphs for a client.  The 
client wants the y-axis to be labeled as, e.g., "15%" rather than as, 
e.g., .15.  The range of proportions for these graphs varies quite a bit 
(from a max of less than .05 to a max of over .2) so I don't want to 
force them all to be the same.

After seeing a graph, it is easy enough to use the ylabel option to get 
what I want.  Given that I am generally willing to live with Stata's 
automatic choice of tick marks, is there a way to automatically get 
labels in the form I want (e.g., "15%") rather than the way Stata wants 
(e.g., .15)?

Thanks,

Rich
*
*   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/


*
*   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