Categorical graphs

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Categorical graphs

Postby javiersan » Wed Jan 27, 2010 12:34 pm

Hi,

I have a group of time series and I want to do a categorical bar chart where each category is defined by the series

group g1 x y z w

Manually, when I click on the group, select graph, bar and categorical chart the chart created comes as I want it. However, I am not sure about the command for plotting this and the help is not very clear.

If I use
g1.bar(contract=raw)

EViews shuts down (well, the option "raw" doesn't exist but it is the closest to the options in the graph menu).

Could you please help?

Thanks,

Javier

EViews Pamela
EViews Developer
Posts: 54
Joined: Wed Sep 17, 2008 2:52 pm

Re: Categorical graphs

Postby EViews Pamela » Wed Jan 27, 2010 3:06 pm

You can define a categorical graph using the "within" and "across" keywords. For instance,

g1.bar within(s1)

Note that if you do not define an across or within series in the dialog, it will produce a standard graph even though you have selected Categorical graph in the dropdown.

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Categorical graphs

Postby javiersan » Wed Jan 27, 2010 4:50 pm

Thanks Pamela, g1.bar within() did work.

I have now 4 charts in one and they have as legend the series name, is there a way I can do two things (i) change the labels without changing the name of the series and (ii) change individual charts axis range?

Thanks,

Javier

EViews Pamela
EViews Developer
Posts: 54
Joined: Wed Sep 17, 2008 2:52 pm

Re: Categorical graphs

Postby EViews Pamela » Wed Jan 27, 2010 6:44 pm

To change the legend text, use the "legend" option with the "setelem" command. For instance, to modify the second series:

graph01.setelem(2) legend("new_text")

You may use the "axis" command to set the data endpoints for all graphs simultaneously:

graph01.axis range(-2,2)

Pamela

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Categorical graphs

Postby javiersan » Thu Jan 28, 2010 2:44 am

Unfortunately it doesn't seem to work for me.

None of the two options below work:

group g1 x y z w
g1.bar within()
g1.setelem(1) Series x '<------ this gives an error

group g1 x y z w
freeze(g1_chart) g1.bar within()
g1_chart.setelem(1) Series x '<------- this doesn't show anything

Other options for the 'freeze' chart work such as addtext or align.

Any clues why?

Thanks,

Javier

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Categorical graphs

Postby javiersan » Thu Jan 28, 2010 2:45 am

Correction: I meant .setelem(1) legend("Series x")

EViews Pamela
EViews Developer
Posts: 54
Joined: Wed Sep 17, 2008 2:52 pm

Re: Categorical graphs

Postby EViews Pamela » Thu Jan 28, 2010 12:33 pm

The setelem command should be used with a graph. So it is true that group01.setelem will not work; you will need to freeze the graph first and use graph01.setelem.

graph01.setelem(1) legend("legendtext") should change the legend text.

Also, let me emphasize that if you do not specify an across or within series, you are not really getting a categorical graph.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests