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

st: RE: Overlapping variable labels


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Overlapping variable labels
Date   Fri, 5 Aug 2005 14:29:11 -0500

Take a look at the suboptions available for the over() option.  A few
possibilities come to mind:

1. Redefine the labels
2. Alternate the label ...label(alt)...
3. Changing the angle...label(angle(45))...
4. And, or changing the size.... label(labsize(vsmall))...

As Nick pointed out, attachments are acceptable.  Rather than sending data
files or output you can often replicate the problem with one of the sample
data set (see -sysuse- and -webuse-) or place a small extract of the data in
the email message.

For example,

webuse census, clear

label define cenreg 4 "United States - West", modify
label define cenreg 3 "United States - South", modify
label define cenreg 2 "United States - North Central", modify
label define cenreg 1 "United States - North East", modify

graph bar marriage divorce, over(region) name(gr1)

*Help, the labels over lap!

*Solutions:

graph bar  marriage divorce, over(region, label(alt)) name(gr2)

graph bar  marriage divorce, over(region, label(angle(45))) name(gr3)

graph bar (mean) marriage (mean) divorce, ///
 over(region, label(labsize(vsmall))) name(gr4)



Hope this helps,
Scott

 
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Raphael Fraser
> Sent: Friday, August 05, 2005 11:35 AM
> To: [email protected]
> Subject: st: Overlapping variable labels
> 
> Dear All
> 
> When ever you plot a bar graph stata uses the variable label of the
> "over( variable)" to label the horizontal axis. My problem is the
> labels overlap on the horizontal axis and looks a bit messy. How can
> this be corrected?
> 
> My code and graph is attached. Thank you in advance.
> 
> #d;
> graph bar (count) p c, over(response)
>         bargap(-20) bar(1,bcolor(red)) bar(2,bcolor(green))
> bar(3,bcolor(gold))
> 	 blabel(bar, format(%4.0f) position(outside))
> 	 legend(label(1 "Patients") label(2 "Controls") )
>          ytitle("Frequency") yla(,angle(0));
> #d;
> 
> Raphael


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