Code to graph series in multiple frequencies

For questions regarding programming in the EViews programming language.

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

BT454
Posts: 135
Joined: Wed Aug 02, 2017 6:07 am

Code to graph series in multiple frequencies

Postby BT454 » Mon Mar 18, 2019 1:37 pm

Hi!
Is there code available to graph series of different frequency types on one graph?
For instance I'd like plot of line graph of daily price data on the right axis, and a bar graph of weekly natural gas data on the left axis, on the same graph.
Thanks!
Bob

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Code to graph series in multiple frequencies

Postby EViews Gareth » Mon Mar 18, 2019 2:18 pm

Code: Select all

wfcreate(page=q) a 1990 2020
series y=rnd*100
pagecreate(page=m) m 1990 2020
series x=rnd*10
copy(link) q\y m\y
group g  y x
freeze(mygraph) g.line
mygraph.setelem(2) axis(r)
mygraph.axis overlap   'this is optional depending on your feelings
show mygraph
Follow us on Twitter @IHSEViews

BT454
Posts: 135
Joined: Wed Aug 02, 2017 6:07 am

Re: Code to graph series in multiple frequencies

Postby BT454 » Wed Mar 20, 2019 9:43 am

Thank you very much!
One more question:
How would I make one series a bar, and the other series a line?
Thanks again,
Bob

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Code to graph series in multiple frequencies

Postby EViews Gareth » Wed Mar 20, 2019 9:47 am

Follow us on Twitter @IHSEViews

BT454
Posts: 135
Joined: Wed Aug 02, 2017 6:07 am

Re: Code to graph series in multiple frequencies

Postby BT454 » Wed Mar 20, 2019 10:06 am

Thanks,
When I use the code:
freeze(mygraph) g.mixed bar(sdfyinvusl48) line(pnhh)
to create a mixed graph the series I'd like to keep in daily (pnhh) converts to weekly.
Is there a way to use this command and keep the series pnhh as daily frequency, and not convert to weekly?
Here is the full code:
copy(link) daily\pnhh comps\pnhh
group g sdfyinvusl48 pnhh
freeze(mygraph) g.mixed bar(sdfyinvusl48) line(pnhh)
mygraph.setelem(1) axis(l)
mygraph.setelem(2) axis(r)
mygraph.axis overlap

please note, if i replace the freeze command above with this:
freeze(mygraph) g.line
the pnhh series stays in daily frequency and does not convert to weekly.
Thanks!

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

Re: Code to graph series in multiple frequencies

Postby EViews Jason » Wed Mar 20, 2019 3:32 pm

Unfortunately with mixed graphs, we do not support mixed frequency plots. We look into possibly adding the feature in the future


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 31 guests