Statalist The Stata Listserver


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

Re: st: labeling bars with twoway bar and rcap


From   [email protected]
To   [email protected]
Subject   Re: st: labeling bars with twoway bar and rcap
Date   Tue, 09 Jan 2007 14:58:10 -0600

One way would be to use -scatter , mlab()- 

For example:

sysuse auto,clear
collapse (mean) mpg (max) max = mpg (min) min = mpg, by(rep)
format mpg %9.3g
twoway bar mpg rep if rep == 1 , horiz || ///
 bar mpg rep if rep == 2 , horiz || /// 
 bar mpg rep if rep == 3 , horiz || ///
 bar mpg rep if rep == 4 , horiz || ///
 bar mpg rep if rep == 5 , horiz || /// 
 rcap max min rep , horiz  lcolor(black)  || /// 
 scatter  rep mpg, msym(none) mlab(mpg) mlabpos(11) mlabcolor
(black) /// 
 legend(order(1 "Fakult 1" 2 "Fakult 2" 3 "Fakult 3" 4 "Fakult 4" ))

Scott


----- Original Message -----
From: Daniel Becker <[email protected]>
Date: Tuesday, January 9, 2007 1:07 pm
Subject: st: labeling bars with  twoway bar and rcap
To: [email protected]

> Dear statalist,
> 
> the following command gives me the plot you can see here:
> http://www.wiwi.uni-rostock.de/~wsf8545/test.png
> 
> 
> graph twoway
> (bar meanwrite Z_faks if Z_faks==0, horizontal)
> (bar meanwrite Z_faks if Z_faks==1, horizontal)
> (bar meanwrite Z_faks if Z_faks==2, horizontal)
> (bar meanwrite Z_faks if Z_faks==3, horizontal)
> (rcap hiwrite lowrite Z_faks, lwidth(thick) lcolor(black) 
horizontal),
> legend(order(1 "Fakult 1" 2 "Fakult 2" 3 "Fakult 3" 4 "Fakult 4" ) 
> 
> cols(1) width(100));
> 
> Is it possible to label the bars? Such that the upper yellow bar 
> has  
> a 3.8 somewhere, the lower blue one a 3.5 etc.
> 
> I tried to use blabel(), searched the web, but to no avail.
> 
> Thanks for your help.
> 
> Daniel

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