Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: complicated twoway graph

 From Maria Sokolova To statalist@hsphsun2.harvard.edu Subject Re: st: complicated twoway graph Date Thu, 9 May 2013 14:01:22 -0700 (PDT)

```Thanks, Sergiy!
Thanks a lot -  my knowledge of stata is yet to be improved..
Have several questions:
1) I did not manage to stack the variables one after each other, but summed them up (together they are 1) and have put in the right order so now it looks like true.. what is the option for stacking? -well, if not, you can ignore that, as I managed to do it anyhow.. what matters that it worked
2) can you refer me to how to force stata to recycle the colors with a period? I could not figure out... 1 2 3 from below give the "big" colors, but how do I force the "small" colors?
3) sc t1 zero gives me a line of dots on the 0 line in the middle from t1 which represents the periods - how do I "hide" this?
4) how (and also - where) do I put the option for every 4th gorizontal year to be thicker (cutoff for the year)?

twoway bar bigVCPv1 bigLCPv1 bigPCPv t1, horizontal || /*
*/bar smallVCPv1 smallLCPv1 smallPCPv t1, horizontal, ||/*
*/sc t1 zero,/*
*/xtitle( "Currency pricing per groups of companies" )  ytitle("")/*
*/legend(label(1 VCP) label(2 LCP) label(3 PCP)) legend(order(1 2 3))/*
*/ysca(noline) ylabel(none) xsca(noline titlegap(-0.1))/*
*/xlabel(-1 "1"-0.75 "75%" -0.5 "50%" -0.25 "25%" 0 "0" 0.25 "25%" 0.5 "50%" 0.75 "75%" 0(1)1 , tlength(0) grid gmin gmax)

Maria

> Тема: Re: st: complicated twoway graph
> Кому: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> Дата: Четверг, 9 май 2013, 20:54
> Maria,
>
> This is a pretty standard stacked horizontal bar graph. The
> trick is:
> 1) do NOT use the 'percent' option, but compute the shares
> yourself, then
> 2) supply the resulting variables in right order (so that l1
> of big
> has is in the same position from the axis as l1 of large),
> 3) suppress half of the legend (it is identical for big and
> small firms), and
> 4) make Stata recycle the colors within the chart with
> required period
> (3 in your case), and finally
> 5) relabel the axis (this is shown in the example you
> quote).
>
> optionally the gaps can be removed like here:
>
> Let me know if you need more help.
>
>
> On Thu, May 9, 2013 at 11:57 AM, Maria Sokolova <megami2717@yahoo.com>
> wrote:
> > Yes, thanks so much! How do you syntax the twoway praph
> to do it like that?
> >
> пишет:
> >
> >> Тема: Re: st: complicated twoway graph
> >> Кому: "statalist@hsphsun2.harvard.edu"
> <statalist@hsphsun2.harvard.edu>
> >> Дата: Четверг, 9 май 2013, 19:45
> >> Hi Maria,
> >> do you mean something like this?
> >> Sergiy
> >>
> >> On Thu, May 9, 2013 at 8:18 AM, Maria Sokolova
> <megami2717@yahoo.com>
> >> wrote:
> >> > Hi everyone!
> >> > Need to figure out if stata 12 can generate a
> twoway
> >> graph bar with two distributions both being
> cumulative.
> >> > Explaining on example: I have 20 periods of
> time for
> >> which I have 3 measures for 2 groups of companies.
> The
> >> measures for each group sum up to 100% per each
> period.
> >> > I need a  graph akin to http://www.ats.ucla.edu/stat/stata/library/GraphExamples/code/twobar4.htm,
> >> but with cumulations on both sides for each
> period.
> >> >
> >> > the example of the data would be:
> >> >
> >> >
> >>    L1
> >>
> >>    L2
> >>
> >>    L2
> >> >
>    big
> >>    small
> >>      big    small
> >>        big
> >>    small
> >> > q1       5
> >>    7
> >>        8
> >> 9
> >>    12
> >>    3
> >> > q2       6
> >>    9
> >>       10
>    13
> >>
>    15
> >>      9
> >> > q3       9
> >>    13
> >>        7
> >> 9
> >>    13
> >>    8
> >> > q4       14
> >>    16
> >>         8
>     10
> >>              9
> >>       7
> >> >
> >> >
> >> > Thanks in advance,
> >> > Maria
> >> >
> >> > *
> >> > *   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/
> >>
> >
> > *
> > *   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/
>

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