I would like to create a stacked bar chart with labels that indicate
the total height of the bars. The imaginary dataset below compares
two countries:
country onelang twolang
A 30 10
B 20 5
The variable "onelang" is the share of the population that speaks one
foreign language, "twolang" is the share that speaks two foreign
languages. The data can be used to create a stacked bar chart.
. graph bar onelang twolang, over(country) stack blabel(bar)
We can see that in country A 40 percent speak at least one foreign
language and in country B 25 percent speak at least one foreign
language. I want these values to appear in the graph. The Graphics
manual states under "blabel_option" that "blabel(total) specifies
that the label be the cumulative height of the bar. blabel(total) is
for use with graph bar's stack option" and then gives an example
where "the labels would be the total height of the stacked bar."
. graph bar onelang twolang, over(country) stack blabel(total)
and
. graph bar (sum) onelang twolang, over(country) stack blabel(total)
draw identical graphs with labels that are not what I expected. I do
not understand what the labels (36.5 and 16.5 for country A, 80.9 and
65.9 for country B) stand for.
I have two questions:
(1) How can I create a stacked bar chart that has one label at the
top of each bar, indicating the cumulative height (40 for country A
and 25 for country B)? All other bar labels should be suppressed.
(2) What is the meaning of the values created by the blabel(total)
option?
Thank you.
Friedrich Huebler
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
*
* 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/