Format zeroline

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

Thomasms90
Posts: 15
Joined: Wed Mar 20, 2013 7:14 am

Format zeroline

Postby Thomasms90 » Sun Jul 26, 2015 3:19 am

Is it possible to format the zeroline? Ideally I'd like it in the background in light grey, dashed and 0.25 width.

I can't find any option to do this and tried specififying some parameters after the -dashline parameter in my program, but it doesn't help.

I also tried creating an extra series that's always equal to zero and format that, however that line doesn't fill the whole horizontal area (i.e. doesn't extend to the vertical axis lines).

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Format zeroline

Postby EViews Jason » Mon Jul 27, 2015 10:44 am

Unfortunately the zero line isn't customizable. I can't think of any workarounds that will go from end to end, be drawn in the background, gray, and .25 pts wide.

The closest thing you could do is draw a gray line 0.25 wide from end to end but it wont be in the background.

Thomasms90
Posts: 15
Joined: Wed Mar 20, 2013 7:14 am

Re: Format zeroline

Postby Thomasms90 » Mon Jul 27, 2015 10:58 am

Okay. It should be okay with a regular line if it's possible to get it from end to end, I just haven't been able to. Can you explain how?

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Format zeroline

Postby EViews Jason » Mon Jul 27, 2015 2:42 pm

Here is an example

NOTE: you will need EViews 9

Code: Select all

create u 10
series x=rnd-.5

graph g.line x

' note units are in graph virtual inches

!x_9 = g.@axispos(9, "b")   ' x pos at observation 9
!x_10 = g.@axispos(10, "b")   ' x pos at observation 10

!obsdist = !x_10-!x_9     ' the width of 1 observation
!xmax =  !x_10+!obsdist/2   'the x pos of the end of the bottom axis

!yzero = g.@axispos(0, "l")   ' y position where the data equals 0

g.addarrow pos(0, !yzero, !xmax, !yzero) linewidth(0.25) color(@rgb(200,200,200)) startsym(none) endsym(none) pattern(2)

Dag Kolsrud
Posts: 8
Joined: Mon Jul 17, 2017 3:49 am

Re: Format zeroline

Postby Dag Kolsrud » Sat Sep 05, 2020 2:33 am

In a program two series of weekly and quarterly frequency is generated on different pages in the same workfile:

pageselect w
smpl 2007 @now
genr spgrowth = 100*((index_sp500-@elem(index_sp500, "2007"))/@elem(index_sp500, "2007"))

pageselect q
smpl 2007 @now
graph g.line w\spgrowth ((qusa_sa-@elem(qusa_sa, "2007"))/@elem(qusa_sa, "2007"))*100

To draw a zero line in a graph I use (among others) the command

!yzero = g.@axispos(-0.002, "l") ' y position where the data equals 0

which resulted in an error message. Changing the code to

pageselect w
smpl 2007 @now
genr spgrowth = 100*((index_sp500-@elem(index_sp500, "2007"))/@elem(index_sp500, "2007"))

pageselect q
smpl 2007 @now
genr qusagrowth = 100*((qusa_sa-@elem(qusa_sa, "2007"))/@elem(qusa_sa, "2007"))
graph g.line(a) qusagrowth w\spgrowth

so that there is no y-scaling (by *100) in the graph command apparently solved the problem. Is it so that transformations of series in the graph command may ‘confuse’ @axispos and cause an error?

graph-kommandoen laget problemer for y-skal ‘forståelsen’ til @axispos.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: Format zeroline

Postby tvonbrasch » Tue Sep 22, 2020 12:10 pm

Gareth, any thoughts?
t

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Format zeroline

Postby EViews Jason » Tue Sep 22, 2020 1:23 pm

There is apparently an issue with @axispos on graphs that use series from another workfile page.

We will get it fixed in the next patch.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: Format zeroline

Postby tvonbrasch » Tue Sep 22, 2020 9:05 pm

Great, thanks!
t


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 38 guests