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
Yuval Arbel <[email protected]>
To
statalist <[email protected]>
Subject
Re: twoway bar [was: Re: st: Features for Stata 14]
Date
Wed, 4 Sep 2013 22:46:29 +0300
Thanks very very much again. Now the graphs are perfect!!!
On Wed, Sep 4, 2013 at 10:30 PM, Scott Merryman
<[email protected]> wrote:
> You can do this to a limited extent:
>
>
> 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 - .25 if _j ==1
> l
> twoway bar v ind if _j == 1, barwidth(.25) ytitle("") ///
> || bar v ind if _j == 2, yaxis(2) barw(.25) ytitle("", axis(2)) ///
> || , ylabel(.4(.1).8) xlabel( .875 "1" 1.875 "2" 2.875 "3") ///
> legend(order( 1 "Proj Red" 2 "Months")) name(gr1, replace)
>
>
> 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 - .4 if _j ==1
> l
> twoway bar v ind if _j == 1, barwidth(.4) ytitle("") ///
> || bar v ind if _j == 2, yaxis(2) barw(.4) ytitle("", axis(2)) ///
> || , ylabel(.4(.1).8) xlabel( .8 "1" 1.8 "2" 2.8 "3") ///
> legend(order( 1 "Proj Red" 2 "Months"))
>
>
>
> On Wed, Sep 4, 2013 at 1:01 PM, Yuval Arbel <[email protected]> wrote:
>> Scott, many many thanks it looks almost perfect.
>>
>> If it's not too much trouble, I would like the bars thinner and
>> adjacent, and to create equal spaces between categories 1 and 2 and
>> categories 2 and 3.
>>
>> P.S. This is very important - in some of the best econ journals they
>> ask for the data in order to replicate the outcomes
>>
>> On Wed, Sep 4, 2013 at 10:34 AM, Scott Merryman
>> <[email protected]> wrote:
>>> 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/
>>
>>
>>
>> --
>> Dr. Yuval Arbel
>> School of Business
>> Carmel Academic Center
>> 4 Shaar Palmer Street,
>> Haifa 33031, Israel
>> e-mail1: [email protected]
>> e-mail2: [email protected]
>> You can access my latest paper on SSRN at: http://ssrn.com/abstract=2263398
>> You can access previous papers on SSRN at: http://ssrn.com/author=1313670
>> *
>> * 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/
--
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street,
Haifa 33031, Israel
e-mail1: [email protected]
e-mail2: [email protected]
You can access my latest paper on SSRN at: http://ssrn.com/abstract=2263398
You can access previous papers on SSRN at: http://ssrn.com/author=1313670
*
* 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/