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]

st: RE: hbar & labels


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: hbar & labels
Date   Mon, 21 Mar 2011 12:37:04 +0000

It sounds to me as if you would be better off with a -histogram-. 

The presumption of -graph bar- (which you use in your code) and of -hbar- (which you refer to) is in essence that you have a breakdown by categorical variables, which you will want to see named. 

. histogram age [w=totpop], discrete freq

is a start. You can control labels very easily with that. 

Nick 
[email protected] 

María Edo

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)

My code is the following:

input age totpop
10  100
11  200
12  150
13   300
14   220
15   330
end
graph bar totot, over(age, label(alternate labsize(*.5)) )

Let´s say, in this small dataset case, I would only like the labels
"10" and "15" to appear.
I am sure there is a trivial way of achieving this, but I haven't been
able to find it.

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