# Re: st: AW: simple "graph twoway, b()" question

 From Markus Pannenberg To statalist@hsphsun2.harvard.edu Subject Re: st: AW: simple "graph twoway, b()" question Date Wed, 25 Feb 2009 20:39:26 +0100

```Thanks to Nick and Martin for their comments!

For anyone who is interested:

twoway (line gdp year), xla(2001(1)2006) by(country)

is a perfect solution for my little problem!

Markus

On Wed, Feb 25, 2009 at 6:30 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> You may get better control by specify -xla()- instead.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Martin Weiss
>
>
> Well,  how close is the third line in my suggestion
>
> line le year, xsc(r(1850 2006)) by(x)
>
>
> Markus Pannenberg
>
> Thanks Martin, you are right! (I also figured this out before sending
> my e-mail to the stata-list....).
>
> However: Does anyone know a work-around...?
>
> On Wed, Feb 25, 2009 at 5:53 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>>
>> The thing - in my view - is that not every -twoway- option carries over to
>> the -by- options. See
>
>> help by_option
>
> Try
>
> sysuse uslifeexp, clear
> set seed 1001
> g x =runiform()>0.5
> line le year, by(x)
> line le year, xsc(r(1850 2006))
> line le year, xsc(r(1850 2006)) by(x)
> line le year, by(x, xsc(r(1850 2006)))
>
> and note the different behavior.
>
> Markus Pannenberg
>
>> I have a simple "graph twoway, by()" question:
>>
>> When I type:
>>
>> (1) twoway (line gdp year),  by(country),
>>
>> Stata creates a graph with plots for all countries and a range for the
>> x axis starting in 2000 though the minimum of the variable year is
>> 2001!
>>
>>
>> When I type:
>>
>> (2) twoway (line gdp year),  xsc(r(2001 2006)),
>>
>> Stata creates a graph with a range for the x axis starting in 2001.
>>
>> However, when I combine (1) and (2), i.e.
>>
>> (3) twoway (line gdp year), by(country, xsc(r(2001 2006)))
>>
>> Stata tells me: "option xsc() not allowed" r(198)!
>
> *
> *   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/
```