Hello,
My query is about how to automate the process of generating a specific type of graph in Eviews.
At present I have been manually generating a mixed graph with bars; two series map lines, and shaded areas as bars based on the dummy values of a third series. Each time, I create a group and save it, generate the graph, rename the series legends, and freeze the outcome once I've added axis labels in the frozen window so I can save it. When I generate the graph I change the dummy series to "right" on the "series axis assignment" and "axis scale end points" are changed to "Data minimum and maximum". There are other options also changed but many of these (such as hiding the tick marks on the right hand scale, selecting B&W, line colours etc) I have changed in the default settings.
My question is this: Is there a way of automating this graph generation process? I Need to generate 100+ graphs so it would be extremely time saving if so. I would like to write a loop to do this with but am struggling with the code to get the graph to generate in the needed format. I am using Eviews 8.
Any help would be much appreciated- thanks in advance.
automating mixed line/bar graph generation
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
David Clark
- Posts: 7
- Joined: Tue Jun 30, 2015 11:54 am
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: automating mixed line/bar graph generation
All of what you have described can be put into an EViews program.
If you had EViews 9, you could use the command capture technology to write the program for you.
In EViews 8 you'll have to look up the commands manually. You want the group and graph sections of Chapter 1 of the Object Reference (pdf available from help menu).
Graph.setelem and graph.axis are going to be the most useful parts for you.
If you had EViews 9, you could use the command capture technology to write the program for you.
In EViews 8 you'll have to look up the commands manually. You want the group and graph sections of Chapter 1 of the Object Reference (pdf available from help menu).
Graph.setelem and graph.axis are going to be the most useful parts for you.
-
David Clark
- Posts: 7
- Joined: Tue Jun 30, 2015 11:54 am
Re: automating mixed line/bar graph generation
Thank you for your response.
Based on your advice I have tried using Eviews 9 to do this. I have tried to use the below code, derived from the sections of the command capture files referenced in your response alongside the capture window in Eviews 9:
Where g is a group of 3 variables. I keep getting the error:
Hence why I've tried to use axis and setelum to modify the specifics.
Please can you advise me on how to proceed? I really appreciate the guidance.
Based on your advice I have tried using Eviews 9 to do this. I have tried to use the below code, derived from the sections of the command capture files referenced in your response alongside the capture window in Eviews 9:
Code: Select all
g.mixed bar(1) line(2,3)
g.setelem(1) axis(right)
g.axis(right) range(minmax)
or commenting out the second line:SETELEM is not a valid view for G in "DO_ G.SETELEM(1)
AXIS(RIGHT)".
I have also checked the command capture section when manually generating the graph. Unfortunately the only code it provides for the grouping and creating the graph with all the necessary criteria specified is this:AXIS is not a valid view for G in "DO_ G.AXIS(RIGHT)
RANGE(MINMAX)".
Code: Select all
{%group}.sheet
{%graph}.mixed bar(1) line(2,3)
Please can you advise me on how to proceed? I really appreciate the guidance.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: automating mixed line/bar graph generation
The graph commands only work on a graph object. So you will have to freeze the group into a graph object.
Code: Select all
freeze(gr) g.mixed bar(1) line(2,3)
gr.setelem(1) axis(right)
gr.axis(right) range(minmax)
-
David Clark
- Posts: 7
- Joined: Tue Jun 30, 2015 11:54 am
Re: automating mixed line/bar graph generation
Thank you for your response - with the freezing option this now works! This is a great help.
However some of the legend options have not worked. The legend option for the first variable works but 2 and 3 do not work, but no error message is given. Instead, the legend includes the data series name for variables 2 and 3. I have tried changing the order and checking the user guide section of setelem but to no avail. I've enclosed the entire code just in case it might be a related issue to what I've included.
Is there something I've missed or misspecified? I've tried including text for gr.setelem(1) but this also appears, so it just seems to be isolated to the lines of gr.setelem(2) and (3).
Many thanks.
However some of the legend options have not worked. The legend option for the first variable works but 2 and 3 do not work, but no error message is given. Instead, the legend includes the data series name for variables 2 and 3. I have tried changing the order and checking the user guide section of setelem but to no avail. I've enclosed the entire code just in case it might be a related issue to what I've included.
Code: Select all
freeze(gr) g.mixed bar(1) line(2,3)
gr.axis(right) range(minmax)
gr.axis(left) units("GSADF statistic and Critical Values")
gr.addtext(l) "GSADF & Critical Values"
gr.setelem(1) axis(right) legend("")
gr.setelem(2) axis(left) legend("GSADF Critical Value")
gr.setelem(3) axis(left) legend("GSADF")
Many thanks.
-
EViews Jason
- EViews Developer
- Posts: 870
- Joined: Tue Sep 16, 2008 3:50 pm
Re: automating mixed line/bar graph generation
It will be fixed in the next patch
Who is online
Users browsing this forum: No registered users and 2 guests
