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

RE: st: RE: percent format


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: percent format
Date   Mon, 13 Jun 2005 23:16:35 +0100

Interesting example. My generalisation was too
rash. -*label()- is too general a claim, as 
there doesn't seem to be a way of doing this with 
-blabel()-. You do need a percent format for
-blabel()-. 

You could remove -yscale(off)- 
and do this with -ylabel()-. 

Nick 
n.j.cox@durham.ac.uk 

Frank de Libero
 
> You wrote:
> I doubt you're missing anything. If you 
> say within a -*label()- option 
> 
> .375 "37.5%" 
> 
> you are saying that even though the 
> number is really .375 you want a display 
> of "37.5%". This is a self-knitted percent 
> format on the fly. 
> ---------------------------------------------
> I don't see it. Here is an example -do- to generate a simple 
> bar chart.
> If I can avoid using -text- I would. But I don't see how to apply a
> label change. I'm probably missing something, but I tried, more time
> than I care to admit.
> 
> ..Frank
> 
> ----------Example do------------------
> 
> version 9.0
> clear
> input coverage pct
> 1  60
> 2  27
> 3   9
> 4  16
> end
> 
> #delimit ;
> label def Coverage
> 1 "Employment-based"
> 2 "Govt. programs"
> 3 "Individual"
> 4 "Uninsured"
> ;
> #delimit cr
> 
> label var cov "Breakdown of insurance coverage"
> label val coverage Coverage
> label var pct "Percent"
> 
> #delimit ;
> 
> ;
> graph hbar (asis) pct, over(cov, sort(cov) axis(noline))
> ylabel(,nogrid) legend(off) yscale(off) asyvars showyvars
> graphregion(margin(l+10 r+10)) scale(1.4)
> graphregion(color(ebg)) plotregion(color(ebg))
> bar(1,color(emidblue))
> bar(2,color(emidblue))
> bar(3,color(emidblue))
> bar(4,color(edkblue))
> bargap(50)
> text(65.5 88.1 "60%", color(black) size(small))
> blabel(bar, position(outside) color(black) format(%3.0f))
> title("Holes in the Net", bexpand span justification(left) 
> color(black))
> subtitle("A breakdown of insurance overage""in the U.S. for 2003:",
> span size(medium) justification(left) bexpand)
> ;
> 
> #delimit cr
> exit

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index