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

st: RE: long labels in -graph bar-


From   [email protected] (Derek Wagner, Stata Corp)
To   [email protected]
Subject   st: RE: long labels in -graph bar-
Date   Tue, 06 Jan 2004 13:46:00 -0600

Jesper Sorensen wrote:

> I want to create a simple bar graph over two variables, e.g.,
>
> . graph bar (asis) rate, over(ever) over(sex)
>
>
> The problem is that the labels for the "Over 1" variable ("ever")
> are quite long and therefore overlap.  I could make the textsize
> very small, but that looks silly.  (I also don't want to switch the
> order of the over( ) variables.)
>
> Ideally what I would like is to have the labels for each value wrap
> from one line to the next.  Eg. instead of
>
>
> Parent ever self-employed   Parent never self-employed
>
> (where the two overlap), instead have
>
>
> Parent ever         Parent never
> self-employed     self-employed


There isn't a way for Stata to automatically wrap your existing value
labels, but you can use the -relabel- suboption with the -over- option
to give your labels two lines.  To create a two-line bar label, you'll
need to include each line of your label in double quotes, and then
enclose the entire label in compound double quotes.  For example, try
the following:

. graph bar (asis) rate, over(ever, relabel(1 `""Parents ever" "self
employed""' 2 `""Parents never" "self employed""')) over(sex)


Derek Wagner
<[email protected]>
*
*   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