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: formatting bar graph by(groups)


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: formatting bar graph by(groups)
Date   Wed, 13 Nov 2013 15:46:52 +0000

I'd recommend two -over()- options here.

The following sequence may be useful.

sysuse auto, clear


graph bar mpg, over(rep78) by(foreign)
graph bar mpg, over(rep78) by(foreign) nofill

Either one has a problem.

graph bar mpg, over(rep78) over(foreign)
graph bar mpg, over(rep78) over(foreign) nofill

I couldn't find a way to put a line in the gap, but here's a way of
heightening the contrast between the second -over()- group.

separate mpg, by(foreign) veryshortlabel

graph bar mpg?, over(rep78) over(foreign) nofill

graph bar mpg?, over(rep78) over(foreign) nofill ///
legend(off) ytitle("`: var label mpg'")

Nick
[email protected]


On 13 November 2013 15:11, B. Timothy Walsh <[email protected]> wrote:
> I am attempting to build a graphical summary of 4 studies using bar graphs
> in Stata12. Two studies need 3 bars and 2 need 2 bars (corresponding to
> different numbers of Treatment cells in the various studies). I am very
> close to having what I want but have a minor annoying problem.
>
> The command I am using includes the following elements, plus some formatting
> directions:
>
> graph bar (asis) Baseline Change, stack over(Treatment) nofill ///
>         by(study, cols(3) holes(4 6) title("Title")
>
> The first 3 graphs—2 with 3 bars and 1 with 2—are fine. Each plot area is of
> the same width and the bars in the 2-bar graph are wider so they are nicely
> centered in the plot region. The problem is with the 4th graph: the 2 bars
> are of the same width as in the 3-bar graphs, so they are over to the left
> and there's a space on the right side where a third bar would go, even
> though there is no third Treatment in that study.
>
> I would like the bars in the 4th graph to be centered within the plot
> region, and of the same width as the other 2-treatment graph.
>
> I hope this description is clear. Happy to supply any additional
> information. Thanks in advance!
>
> Tim
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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