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: twoway bar [was: Re: st: Features for Stata 14]


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: twoway bar [was: Re: st: Features for Stata 14]
Date   Wed, 4 Sep 2013 12:34:30 -0500

Thanks for the clarification.

It is possible with some data manipulation and relabeling the x-axis.

clear
input index proj_red months
1 .4763174 24.46892
2 .7769159 68.40548
3 .7805855 45.94017
end

rename (pro mo ) (v1 v2)
reshape long v, i(index)
replace index = index - .5 if _j ==1

twoway bar v ind if _j == 1, barwidth(.5) ytitle("") ///
|| bar v ind if _j == 2, yaxis(2) barw(.5) ytitle("", axis(2)) ///
|| , ylabel(.4(.1).8) xlabel(.75 "1" 1.75 "2" 2.75 "3") ///
   legend(order( 1 "Proj Red"  2 "Months"))


Scott


On Wed, Sep 4, 2013 at 12:05 PM, Yuval Arbel <[email protected]> wrote:
> Hi Scott, and many thanks.Now it looks much better.
>
> Let me try to clarify again the second question:
>
> The current graph displays 6 bars (two bars for each index category 1, 2 and 3):
>
> For each category the thick (blue) bar is red_proj; and the thin
> (pink) bar is the months. Also the latter bar is inside the area of
> the former.
>
> I would not like to have one bar inside the other - but rather - the
> two bars (pink and blue for each category) adjacent to each other. I
> would also like to have the same thickness for both adjacent bars.
>
> Is it possible to shape the graph based on these requirements?
*
*   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