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: Imposing a line graph into a bar graph
From
Syed Basher <[email protected]>
To
[email protected]
Subject
Re: st: Imposing a line graph into a bar graph
Date
Tue, 12 Apr 2011 23:24:56 -0700 (PDT)
Thank you Nick for your kind help. When I tried to extend your example to 6
variables case, I must admit I am struggling. Sometimes bar appears behind one
another. But I guess trial and error will be the way to go.
Syed
----- Original Message ----
> From: Nick Cox <[email protected]>
> To: [email protected]
> Sent: Tue, April 12, 2011 9:35:48 PM
> Subject: Re: st: Imposing a line graph into a bar graph
>
> Your strategy won't work.
>
> -graph bar- and -twoway- are not compatible. You need to switch to
> -twoway- to get this.
>
> Here is a silly example, but some possibly useful technique.
>
> webuse grunfeld, clear
> keep if company == 1
> keep if year < 1945
> graph bar (asis) invest mvalue kstock , over(year)
> gen year2 = year + 0.3
> gen year3 = year - 0.3
> twoway bar invest year3, barw(0.3) || bar mvalue year, barw(0.3) ||
> bar kstock year2 , barw(0.3)
> gen average = (invest + mvalue + kstock) / 3
> twoway bar invest year3, barw(0.3) || bar mvalue year, barw(0.3) ||
> bar kstock year2 , barw(0.3) || line average year
>
> On offsets, see
>
> SJ-7-1 gr0026 . . . . Stata tip 42: The overlay problem: Offset for
>clarity
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . J.
Cui
> Q1/07 SJ 7(1):141--142 (no
>commands)
> tip for graphing several quantities on a continuous axis
>
> which is accessible to all at the SJ website. (42: what a good number;
> I should have taken that one myself.)
>
> On Tue, Apr 12, 2011 at 7:21 PM, Syed Basher <[email protected]> wrote:
>
> > I am using Stata 11.2. I have generated a bar graph using the following
> > command:
> > graph bar us uk jap, over(year)
> >
> > I have a forth variable, which is the average of (us uk jap). I want to
>impose
> > the fourth variable (say x1) on the bar graph as a line graph. I have
tried
> > inserting the command for a line graph [twoway (line x1 year)] into the
> above
> > command, which didn't work. Your help/hint is much appreciated.
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/