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

st: AW: RE: blabels in stacked bar-graph


From   "Jette Schroeder" <[email protected]>
To   <[email protected]>
Subject   st: AW: RE: blabels in stacked bar-graph
Date   Mon, 21 Jun 2004 19:21:16 +0200

Dear Nick:
Thank you very much for your help! I think since there is not an easy
option, I will go for manipulating the graphs after having integrated them
in the word-document.
Jette

-----Urspr�ngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]]Im Auftrag von Nick Cox
Gesendet: Montag, 21. Juni 2004 18:20
An: [email protected]
Betreff: st: RE: blabels in stacked bar-graph


I don't know a way to do this. A different kind
of answer, which possibly you don't want, is
to change to a different graph type, for it's the
stacking of small and large bars that is causing
the difficulty. For example, with the auto data, I can go

tabplot foreign mpg, percent(foreign)

bysort foreign rep78 : gen freq = _N

bysort foreign : gen base = _N

gen percent = round(100 * freq / base)

gen foreign2 = 1.95 - foreign

tabplot foreign rep78 , percent(foreign)  scheme(lean1) plot(scatter
foreign2
	rep78, ms(none) mlabel(percent) mlabpos(0))

The 1.95 here is not general. A more general rule
would be #categories - 0.05. (In -foreign-, 2 categories.)

I guess your underlying problem has the structure of

	vgrup X v2

and the -vgrup?- are just a set of dummies.

So your recipe could be something like this.

-tabplot- is on SSC. There is a discussion in Stata Journal
4(2):

Nick
[email protected]

Jette Schroeder

> I have a problem with the bar-labels of the following stacked
> bar-graph. The
> blabels appear within the bars even when the percentage of
> the group is so
> small, that the resulting area is too small to display the
> number. If for
> example v1grup3 has 0 percent, the 0 appears in the area of v1grup2.
>
> Can I tell Stata to label the parts of the bar only if the
> percentage is
> over let's say 10?
>
>    graph bar v1grup1 v1grup2 v1grup3 v1grup4, scheme(mine)
> over(v2) stack
> percentage
>    blabel(bar,position(inside)format(%2.0f))

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

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