Bookmark and Share

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: hbar & labels


From   David Elliott <[email protected]>
To   [email protected]
Subject   Re: st: hbar & labels
Date   Tue, 22 Mar 2011 10:32:08 -0300

Many people have been bitten by this property of -graph bar-.

Fundamentally, -graph bar- and -graph hbar- are designed to work over
categorical data.  While you have ages 10-99, as far as the bar
routine is concerned your categories could just as well have been red,
orange, ... indigo, violet.  The reason -graph bar- doesn't let you
use a xlabel(10(5)100) is that it is not Cartesian graph and the axis
cannot be treated as if it were numeric - it has to assume every
category is important and must be displayed on the axis.

D C Elliott

On 21 March 2011 09:48, Maarten buis <[email protected]> wrote:
> --- On Mon, 21/3/11, María Edo wrote:
>> I have a horizontal graph bar in which each bar represents
>> the total population for a certain age (from 10 to 99 years).
>> Labels are too many (10 to 99) and make the graph look
>> messy.
>> I would like to reduce the number of labels that appear in
>> the graph, for instance, only multiples of 5 (10, 15, 20,
>> ....99)
>
> The solution is probably to rephrase the command as a
> -twoway bar- comand:
>
> *--------- begin example ---------
> clear
> input age totpop
> 10  100
> 11  200
> 12  150
> 13  300
> 14  220
> 15  330
> end
>
> twoway bar totpop age, ///
>       ylab(10(5)15)   ///
>       xlab(0(100)400) ///
>       horizontal
> *--------- end example ------------
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   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/
>



-- 
David Elliott

Everything is theoretically impossible, until it is done.
Progress is made by lazy men looking for easier ways to do things.
 -- Robert A. Heinlein (American science-fiction Writer, 1907-1988)

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index