how to set legends for some graph elements only

For questions regarding programming in the EViews programming language.

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

melamel
Posts: 30
Joined: Tue May 10, 2016 3:49 am

how to set legends for some graph elements only

Postby melamel » Wed May 11, 2016 2:27 am

Hello,
I want to put a legend for some graph elements only and leave the rest of the elements without a legend. how can I do it please ?

I tried this code:
goup group1 variable1 variable2
freeze(graph) group1.line
graph.setelem(1) legend ("forecast")

But this gives me the following error message:
invalid graph option in "do_graph.setelem(1) legend ("forecast")

what is wrong with this code and how can I leave the rest of the elements without legends?
Thank you for your responses.

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

Re: how to set legends for some graph elements only

Postby EViews Gareth » Wed May 11, 2016 4:34 am

You have a space between legend and ("forecast"). Your approach is correct though, you just have to nuke out the other legend entries:

Code: Select all

create u 100 series y=nrnd series x=nrnd series z=nrnd group g x z y freeze(gr) g.line gr.setelem(1) legend("forecast") gr.setelem(2) legend("") gr.setelem(3) legend("") show gr

melamel
Posts: 30
Joined: Tue May 10, 2016 3:49 am

Re: how to set legends for some graph elements only

Postby melamel » Thu May 12, 2016 1:00 am

Thank you :) !


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests