shaded graph-draw(shade,bottom) isnt visible for last data

For questions regarding programming in the EViews programming language.

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

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

shaded graph-draw(shade,bottom) isnt visible for last data

Postby RM_RM » Fri Jan 15, 2016 9:51 am

Hi team,

I am using draw(shade, bottom) to separate history from forecast in a figure. I am using the command

figure_3.draw(shade,bottom, color(191,191,191)) 2014 2020

However, the grey shading is not showing all the way till the end of the data point. The last one quarter/year area is just white. I have attached the graph for your reference. Could you please tell me how to fix it?

Thanks
Attachments
Example of the graph.docx
No shaded area in the year 2020
(30.36 KiB) Downloaded 655 times

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

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby EViews Jason » Fri Jan 15, 2016 11:42 am

To get what you want, you will need to create the graph in a monthly workfile page. First you will need to link your series from your annual page into your monthly page. After creating the same graph in your monthly page, you can then shade from jan-2014 to dec-2020.

The problem is there is a difference between shading from the year 2014 to the year 2020 vs the value 2014 to the value 2020. EViews is doing the latter.

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby RM_RM » Mon Jan 25, 2016 12:58 am

Hi Jason,

I tried using your suggestion. I have about 12 variables to plot in a graph, which means I have to convert 12 annual variables into monthly variables to get the desired chart format.

What I did was I combined those 12 variables into a group and copied them into another page with monthly frequency. I used "Linear Match Last " to convert from annual to monthly. Now the monthly page has the group variables, but there is no data in it. All values are NA. What am I doing wrong?

This is the set of commands I am using.


group g1 gdp cd cndg cnds hst iprd cogtp ipnr dee rfed rlg


pagecreate(wf="outlook", page="monthly") m 1994m1 2020m12

pagestruct(freq=m,start=1994,end=2020)

'constant match average to convert yearly to monthly
copy(c=r) outlook::annual\g1 outlook::monthly\g1

smpl 1995 2020

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

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby EViews Jason » Tue Jan 26, 2016 2:28 pm

Unfortunately when copying a group from one page to another, the series are not also copied. You only get the group definitions.

You will need to copy the series over as well. For example

Code: Select all

copy(c=r) outlook::annual\gdp outlook::monthly\gdp ...
Alternatively, since you created the monthly page specifically for the graph, you could copy all the objects with 2 lines using

Code: Select all

copy outlook::annual\* outlook::monthly\* 'copy all the objects including the group definitions first copy(c=r, link) outlook::annual\* outlook::monthly\* 'overwrite the series objects with series links and set the conversion method

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby RM_RM » Wed Jan 27, 2016 1:15 am

Thanks, Jason.

The process seems to have got very complicated just to get the shading done for annual data. As of now, it did work, but just out of curiosity, are you guys planning to address this issue sometime later?

Also, I have about 300+ variables in the original annual sheet. But I need only 12 variables of these for the charts. Is there a single copy command such that I move multiple variables from one sheet to the another (of different frequency) at one go, without changing their names that has common letters (i.e. not using /ab* feature by renaming all variables starting with ab as an example) ?

thanks,
RM

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

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby EViews Jason » Wed Jan 27, 2016 10:31 am

To answer your first question, not anytime soon.

For your second question, try

Code: Select all

copy annual\g monthly\* 'copy the group 'g' from the annual page to the monthly %m = g.@members 'get the list of the series in the group 'copy each series from the annual page to monthly page for %s {%m} copy(c=r, link) annual\* monthly\* next

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby RM_RM » Tue May 31, 2016 4:28 am

HI Jason,

I am coming back to you with a similar, but not exactly the same problem and an additional problem

Problem 1:
I am using draw(shade, bottom) to separate history from forecast in a figure. As suggested by you the last time, I changed the data from annual to monthly to get the shaded area till the last monthly period (Please refer to the chain of our conversation below). It worked then. I am currently using the same set of commands, except that the time period has been extended to 2021 from 2020. I am using the command

figure_1.draw(shade,bottom, color(191,191,191)) 2016 2021

I even tried
figure_1.draw(shade,bottom, color(191,191,191)) 2016m1 2021m12

But for some reason the graph is including the year 2022, although the sample period is specified till 2021. You will notice a white space at the end of the graph, for which there is no data as well. (please refer the attachment)

Problem 2:
For some reason the lines for the forecast period are not dotted lines either. I ran the same program last time, and all the four lines for the forecast period were dotted (in the left picture).But this time, where lpat is specified as 2, but the forecast lines are not dotted!!

figure_1.options frameaxes(lb)
figure_1.datelabel format(yy)
figure_1.axis(b) -minor
figure_1.setelem(1) lcolor(0,39,118) lwidth(1.0) lpat(2)
figure_1.setelem(2) lcolor(205,51,0) lwidth(1.0) lpat(2)
figure_1.setelem(3) lcolor(0,161,222) lwidth(1.0) lpat(2)
figure_1.setelem(4) lcolor(20,98,255) lwidth(1.0) lpat(2)
figure_1.setelem(5) lcolor(0,39,118) lwidth(2) lpat(1)

Please refer to the attached figure, which has the same GDP data, but one done 3 months back (left side) and one done currently (right side) using the exact same program.

Looking forward to hearing from you

thanks
Attachments
Sample picture.jpg
Reference file comparing two graphs
Sample picture.jpg (153.02 KiB) Viewed 9830 times

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby RM_RM » Tue May 31, 2016 4:37 am

In continuation:

After posting my previous query, I also noticed that the shaded area doesn't begin from 2016 either, like the way it did the last time. Here is the full set of commands that I have used for your reference

Since I had to convert annual data to monthly data, it starts with the commands to transfer data from one sheet to the other


pagecreate(wf="outlook", page="monthly") m 1994m1 2021m12

pagestruct(freq=m,start=1994,end=2021)

'constant match average to convert yearly to monthly
copy outlook::annual\* outlook::monthly\*
copy(c=i, link) outlook::annual\* outlook::monthly\*


smpl 1995 2021


'Figure 1

graph figure_1 gdp gdp_f gdp_s gdp_r gdph1
figure_1.name(1) Baseline
figure_1.name(2) Coordinated global recovery
figure_1.name(3) Continued slow growth
figure_1.name(4) Recession
figure_1.name(5)
figure_1.legend display position(r) framecolor(255,255,255)
figure_1.addtext(-0.2,-0.8) "Figure 1: Real GDP growth"
figure_1.draw(shade,bottom, color(191,191,191)) 2016 2021
figure_1.addtext(3.3,2.7) "History"
figure_1.addtext(3.9,2.7) "Forecast"
figure_1.addtext(0,-0.3) "(Percent)"

'Formatting

figure_1.options frameaxes(lb)
figure_1.datelabel format(yy)
figure_1.axis(b) -minor
figure_1.setelem(1) lcolor(0,39,118) lwidth(1.0) lpat(2)
figure_1.setelem(2) lcolor(205,51,0) lwidth(1.0) lpat(2)
figure_1.setelem(3) lcolor(0,161,222) lwidth(1.0) lpat(2)
figure_1.setelem(4) lcolor(20,98,255) lwidth(1.0) lpat(2)
figure_1.setelem(5) lcolor(0,39,118) lwidth(2) lpat(1)

thanks,

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

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby EViews Jason » Tue May 31, 2016 3:16 pm

We will get #1 fixed.

For #2, change

Code: Select all

figure_1.options frameaxes(lb)
to

Code: Select all

figure_1.options frameaxes(lb) linepat

RM_RM
Posts: 13
Joined: Mon Nov 10, 2014 5:17 am

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby RM_RM » Wed Jun 01, 2016 5:46 am

Thanks, Jason. the second problem got fixed. However, there was a followup 3rd problem, which is that the recession shading starts from a period later than what it is supposed to. If you compare the two figures that I had attached yesterday, the starting point of the shaded area is different, although both the times the first period of forecast was 2016 in the command

figure_1.draw(shade,bottom, color(191,191,191)) 2016 2021

Did you mean that if you fix the #1 issue, the third one will get fixed automatically?

Thanks for your patience. I really appreciate your help and quick response..
RM

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

Re: shaded graph-draw(shade,bottom) isnt visible for last da

Postby EViews Jason » Wed Jun 01, 2016 8:26 am

#1 and #3 are related, they will both be fixed. Send an email to support@eviews.com sp that we may send you a beta version of the next patch and verify the changes are correct.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests