Page **1** of **1**

### Modify graph axis

Posted: **Fri Sep 11, 2015 4:08 am**

by **hakperest**

Hello ,

I have a graph that was plotted

command. I want modify bottom axis that should be as like as following image. Bottom axis may contain only ordered number (without zero or decimal pointers). How can I do that?

Thanks

Huseyin

### Re: Modify graph axis

Posted: **Fri Sep 11, 2015 8:56 am**

by **EViews Jason**

We are going to need more context. If you have an undated workfile this should already happen, unless I am completely missing what you are asking.

Posting your workfile or an example workfile would be helpful.

### Re: Modify graph axis

Posted: **Sat Sep 12, 2015 12:44 pm**

by **hakperest**

My code is:

Code: Select all

` graph gr_multi.line(a) new`

gr_multi.shade(shade, left) 0

gr_multi.options linepat

gr_multi.setelem(2) lcolor(black) lwidth(2) lpat(1)

and my file is attached.

I need my graph be scaled automatically.

Ploted series have restricted sample and contains only 40 length then bottom axis should be start with zero and continiues until 40.

### Re: Modify graph axis

Posted: **Mon Sep 14, 2015 9:38 am**

by **EViews Jason**

You will have to create a series with the desired labels and then create a XY line graph.

Code: Select all

`load eviewstest`

series trend=@trend

series index = trend-@first(trend) 'create an index series starting at the beginning of the sample

group mygroup index new

freeze(gr_multi2) mygroup.xyline

### Re: Modify graph axis

Posted: **Fri Sep 18, 2015 10:20 am**

by **hakperest**

Your code was great but there is some other problems with this method.

I used following codes and graph shows more timeset. I want it show only bottom axis between zero and 80 but this method shows it within -10 and 90. Where my data includes only zero to 80.

Code: Select all

` %trend=@getnextname("ZZ__trend")`

%index=@getnextname("ZZ__index")

%mygroup=@getnextname("ZZ__mygroup")

series {%trend}=@trend

series {%index} = {%trend}-@first({%trend})-1

%legendArti=%i+ " +"

%legendEksi=%i+ " -"

' graph {%graph}.line {%i}_2_0m -{%i}_2_0m ({%i}_2_0m -{%i}_2_0m)

group {%mygroup} {%index} {%i}_2_0m -{%i}_2_0m ({%i}_2_0m -{%i}_2_0m)

freeze({%graph}) {%mygroup}.xyline

{%graph}.shade(shade, left) 0

{%graph}.options linepat

{%graph}.setelem(1) lcolor(black) lwidth(3) lpat(2) legend()

{%graph}.setelem(2) lcolor(black) lwidth(2) lpat(1)legend({%legendArti})

{%graph}.setelem(3) lcolor(red) lwidth(2) lpat(1) legend({%legendEksi})

{%graph}.setelem(4) lcolor(red) lwidth(1) lpat(2) legend(diff)

{%graph}.setelem(5) lcolor(red) lwidth(1) lpat(2)legend()

{%graph}.setelem(6) lcolor(red) lwidth(0) lpat(2) legend()

{%graph}.options size(4,2) -inbox

{%graph}.legend position(botcenter)

### Re: Modify graph axis

Posted: **Fri Sep 18, 2015 4:05 pm**

by **EViews Jason**

Your sample code does not run for me. I am missing some series such that the following line gives an error

Code: Select all

` group {%mygroup} {%index} {%i}_2_0m -{%i}_2_0m ({%i}_2_0m -{%i}_2_0m)`

In any case, in your code you also have

Code: Select all

`series {%index} = {%trend}-@first({%trend})-1`

Did you mean to add the '-1'. If you remove it I believe it will fix the problem

### Re: Modify graph axis

Posted: **Sat Sep 19, 2015 2:16 am**

by **hakperest**

Thanks a lot. My problem solved with changing smpl

Bu I found an bug about plotting with xyline command.

xyline command ignores first series when it plot and colourized but start from first (trend in this example) when legend command is used.

Code: Select all

%graph="linegraph"

d {%graph}

graph {%graph}.line x1 x2 x3

{%graph}.shade(shade, left) 0

{%graph}.options linepat

{%graph}.setelem(1) lcolor(black) lwidth(2) lpat(2) legend(x1)

{%graph}.setelem(2) lcolor(black) lwidth(2) lpat(1)legend(x2)

{%graph}.setelem(3) lcolor(red) lwidth(2) lpat(1) legend(x3)

group mygroup trend x1 x2 x3

%graph="xylinegraph"

freeze({%graph}) mygroup.xyline

{%graph}.shade(shade, left) 0

{%graph}.options linepat

{%graph}.setelem(1) lcolor(black) lwidth(2) lpat(2) legend(x1)

{%graph}.setelem(2) lcolor(black) lwidth(2) lpat(1)legend(x2)

{%graph}.setelem(3) lcolor(red) lwidth(2) lpat(1) legend(x3)

### Re: Modify graph axis

Posted: **Tue Sep 22, 2015 8:07 am**

by **EViews Jason**

Trend isnt being ignored, it is the x axis. So it will not appear as another line. You are graphing trend vs x1, trend vs x2 and trend vs x3. So this appears correct.

Because Trend is the first element in the group, when setting the legend labels for the other series you have to skip Trend. This I admit may not be intuitive but I think you want

Code: Select all

`{%graph}.setelem(2) lcolor(black) lwidth(2) lpat(2) legend(x1) `

{%graph}.setelem(3) lcolor(black) lwidth(2) lpat(1)legend(x2)

{%graph}.setelem(4) lcolor(red) lwidth(2) lpat(1) legend(x3)