Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: RE: Graph bar with label wtih % symbol at the top of each bar
From
Marcos Vinicius <[email protected]>
To
[email protected]
Subject
RE: st: RE: Graph bar with label wtih % symbol at the top of each bar
Date
Thu, 10 May 2012 16:09:07 -0800
Hello David,
My level of programming in stata is a great limitation. I would be satisfied
getting the labels multiplied by 100.
In my ado file I read the dataset and the code follows to get the graph
graph bar (mean) var1 var2 var3 , bargap(20)
yvaroptions(relabel(1 "text1 " 2 " text2" 3 "text3" )) blabel(bar
,position(outside) format(%4.2f)) ytitle("") ylabel( 0 "0" .2 "20%"
.4 "40%" .6 "60%" .8 "80%" 1 "100%", angle(horizontal)) title("text4")
My question:Should I put this code before graph bar and well done?
> . foreach v of varlist var1 var2 var3 {
> . gen `v'_pct = 100 * `v'
> . }
Thank you in advance,
Marcos
> -----Original Message-----
> From: [email protected]
> Sent: Thu, 10 May 2012 15:08:03 -0700 (PDT)
> To: [email protected]
> Subject: st: RE: Graph bar with label wtih % symbol at the top of each
> bar
>
> Marcos,
>
> I don't think you can get the percentage symbol (%) to show, but you can
> get the number to show as a percentage if you first multiply your binary
> variables by 100, perhaps creating new variables, such as:
>
> . foreach v of varlist var1 var2 var3 {
> . gen `v'_pct = 100 * `v'
> . }
>
> A nice shortcut for labeling your axis is Nick Cox's -mylabels- from SSC.
> Don't use the -myscale(@/100)- option in the example below if you first
> multiply by 100 as in the example above.
>
> . mylabels 0(20)100, myscale(@/100) local(pctlabel) suffix("%")
> . graph bar (mean) var1 var2 var3, ylab(`pctlabel')
>
> David
> --
> David Radwin
> Research Associate
> MPR Associates, Inc.
> 2150 Shattuck Ave., Suite 800
> Berkeley, CA 94704
> Phone: 510-849-4942
> Fax: 510-849-0794
>
> www.mprinc.com
>
>
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Marcos Vinicius
>> Sent: Thursday, May 10, 2012 2:56 PM
>> To: [email protected]
>> Subject: st: Graph bar with label wtih % symbol at the top of each bar
>>
>> Hello,
>> I used the following code to plot a graph representing 3 binary
> variables
>> with ylabel to change the percentage representation.(20% instead of
>> 0.20) and blabel to show the label at the top of each bar. My question:
>> How to get a percentage representation like 20% (instead of 0.20 ) for
>> the label at the top of each bar ?
>>
>> graph bar (mean) var1 var2 var3 , bargap(20)
>> yvaroptions(relabel(1 "text1 " 2 " text2" 3 "text3" )) blabel(bar
>> ,position(outside) format(%4.2f)) ytitle("") ylabel( 0 "0" .2 "20%"
> .4
>> "40%" .6 "60%" .8 "80%" 1 "100%", angle(horizontal)) title("text4")
>> Best regards.
>> Marcos.
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/