# Re: st: Beamplot, order

 From "Alan Neustadtl" To statalist@hsphsun2.harvard.edu Subject Re: st: Beamplot, order Date Mon, 2 Jul 2007 12:45:35 -0400

```One way is to create a variable ordered from low to high across the
X-axis (e.g. 1, 2, 3, ... etc.) in the physical order you want them.
Then you can relabel them in your graph statements using the xlabel
option:

xlabel(1 "5"  2 "1"  3 "6"  4 "2"  5 "7"  6 "3" 7 "8"  8 "9"  9 "4")

Best,
Alan

On 7/2/07, Knag Anne-Christine <anne-christine.knag@imr.no> wrote:
```
```Hi again,
More questions about beamplot (which produces really nice plots by the way).
How can I order the y-axis so that tank goes: 5 1 6 2 7 3 8 9 4 instead of 1
2 3 4 5 6 7 8 9

I have tried the following
generate order = 1 if tank == 5
replace order = 2 if tank== 1
replace order = 3 if tank== 6
replace order = 4 if tank == 2
replace order = 5 if tank== 7
replace order = 6 if tank== 3
replace order = 7 if tank== 8
replace order = 8 if tank== 9
replace order = 9 if tank== 4

beamplot pre_l, over(tank) ytitle("") xtitle ("Pre-spawning length (cm) ")
by(sex)

Thanks!
AC

On 7/1/07 5:13 PM, "Nick Cox" <n.j.cox@durham.ac.uk> wrote:

> For those somewhat in the dark:
>
> 0. -beamplot- is a program on SSC.
>
> 1. As Maarten Buis implied, Anne-Christine's problem is with
> her -graph twoway- syntax. -graph twoway-, underlying -beamplot-, sees
>
> xlabel(0 (100) -800))
>
> and parses that into
>
> xlabel(0 (100) -800)
>
> and
>
> )
>
> It can make no sense of ")" by itself. ")" is, of course, just
> a typo.
>
> 2. There is thus no problem with -beamplot-. You may use -xla()-
> freely to get what you want.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Knag Anne-Christine
>
>> Let me rephrase my question: Can one use xlabel in beamplot?
>> Is it possible
>>
>> I have a beamplot where the scale runs from -1000 to 500
>> (syntax: beamplot
>> weight_loss, over(tank)  ytitle("") xtitle ("Somatic loss (g)
>> ")  by(sex)
>>
>>  I would like to have a scale from 0 to -800 and therefore tried the
>> following:
>> beamplot weight_loss, over(tank)  ytitle("") xtitle ("Somatic
>> loss (g) ")
>> xlabel(0 (100) -800)) by(sex)
>>
>> The error meassage says
>>  ) is not a twoway plot type
>> r(198);
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```