Page 2 of 2

Re: How to assign labels to observations in a scatter plot?

Posted: Tue Sep 13, 2011 2:40 pm
by EViews Gareth
Look up the setelem command in the object reference.

Re: How to assign labels to observations in a scatter plot?

Posted: Wed Sep 14, 2011 9:40 am
by EViews Glenn
If you were to take a look at the setelem entry in the manual, it shows that there is both a

Code: Select all

obslabel
and a

Code: Select all

dotobslabel
the latter of which has both the obs label and the dot as requested. Replace Gareth's obslabel with the dotobslabel.

Re: How to assign labels to observations in a scatter plot?

Posted: Wed Sep 14, 2011 1:45 pm
by Liu
Yes I just read the menu and it's actually in the legend. I didn't realize the meaning of the chart
when I was reading it by myself but now it all came clear to me.

Thanks so much for both of you.

Re: How to assign labels to observations in a scatter plot?

Posted: Thu Sep 15, 2011 8:55 am
by Liu
I am trying to use the above finds to do something on my chart.

Now I can have a dot with text next to it. My idea is: suppose I plot a series as a line graph.
What I want is to have text showing the last data point in my graph such as (2001m1, 123.45). My initial solution is to graph a
dot plot of only the last observation (by creating a new series that has only one observation), and then plot a line of the opriginal series
in the same graph.

The problem is: eviews doesn't allow dot to be the type of the first series in a "mixed lines" graph. It can only be area or bar.


Is there a way I can achieve that?


(I attached a photo of what I wish, however this is by placing the cursor next to the observation rather than generate a real text box by command).

Many thanks.

Re: How to assign labels to observations in a scatter plot?

Posted: Thu Sep 15, 2011 9:02 am
by EViews Gareth
Don't think it can be done.

Re: How to assign labels to observations in a scatter plot?

Posted: Thu Sep 15, 2011 9:45 am
by EViews Glenn
You can freeze and add the text label manually, but there's nothing automatic.

Re: How to assign labels to observations in a scatter plot?

Posted: Thu Sep 15, 2011 11:34 am
by Liu
yes addtext another way I was thinking. and that leads to another thing.
as you know, graph.addtext(x,y,textcolor) is the command to locate the text box coordinates.
I just wonder if there is a way to let the program to return the coordinates of a certain data point?

for example, for an observation of (123.45,2001q1), is there a way to return the coordinate of this datapoint from the
graph?

Re: How to assign labels to observations in a scatter plot?

Posted: Thu Sep 15, 2011 11:37 am
by EViews Gareth
No, which is why it impossible to add the text automatically.

Re: How to assign labels to observations in a scatter plot?

Posted: Tue Jan 20, 2015 5:17 pm
by CharlieEVIEWS
Dear all,

I'm struggling to find the command line/batch syntax to change the font on .setobslabel. For example, taking a minor variation on Gareths example from above (with no alpha series), how would I change the size of the 'h' in the graph here without using the menus?

Code: Select all

create u 20 series x=nrnd series y=nrnd group g x y freeze(graph1) g.scatpair graph1.setelem(1) symbol(obslabel) graph1.setobslabel(series) h h h h h h h h h h h h h h h h h h h h h h h h show graph1
Best wishes as always

Charlie

Re: How to assign labels to observations in a scatter plot?

Posted: Wed Jan 21, 2015 9:15 am
by EViews Jason
It depends on which h you wish to set the font for.

If you want to change the font for the labels on the axes use

Code: Select all

graph1.setfont axes(20) 'set to 20pt
If you want to change the font for the labels within the graph

Code: Select all

graph1.setfont obs(16) 'set to 16pt