Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: producing graph bar help


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: producing graph bar help
Date   Thu, 10 Jan 2008 16:57:28 -0600

As part of a thread where <[email protected]> (bw) wants to overlap the
bars in a -catplot- (author Nick Cox <[email protected]>), bw writes

> i am just wondering though why bargap(-30) did not work i.e.
> neither:
>
> graph bar (count) x if ind_methd != "emerg" , 
>       over(ind_methd) over(year) bargap(-30)
>
> nor
>
> catplot bar ind_methd if ind_methd != "emerg", over(year) bargap(-30)

It is subtle, but as the documentation for option -bargap()-states, it affects
the "gap between yvar bars ...".  Because bw has only a single yvar
(y-variable), the variable x, there are no gaps between the y-variables to
reduce.

Note, however, that the option -over()- itself has a -gap()- suboption that
affects the "gap between bars within over() category".  So, if bw will put a
-gap()- suboption in his first -over()- option, the bars within the over can
be made to overlap --

graph bar (count) x if ind_methd != "emerg" , 
      over(ind_methd, gap(-30)) over(year) 
                    ^^^^^^^^^^
Because only the y-variable bars take on different colors, and because bw has
only one y-variable, this specification overlaps bars of the same color, which
does not look good to my eyes.

Alternately, bw can specify that the first over() groups be treated as
y-variables and then return to using -bargap(-30)- to create an overlap

graph bar (count) x if ind_methd != "emerg" , 
      over(ind_methd) over(year) asyvar bargap(-30)
                                 ^^^^^^^^^^^^^^^^^^

Now, the bars for each category in variable ind_methd will be a different
color.

I don't know how this maps to -catplot-, and as Nick said earlier he didn't
explicitly write -catplot- to work with the option -over()-.  Regardless, I
noticed that placing a -gap()- suboption within the -over()- options on a
-catplot- does affect the gaps between bars.  Assuming -catplot- is otherwise
doing what bw wants, the -gap()- suboption may get him the look he wants.

 
-- Vince 
   [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