Labels in scatterplot

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Labels in scatterplot

Postby tvonbrasch » Mon Nov 18, 2013 11:58 am

Hi

how do i label the observations in a scatterplot?

i have a scatterplot (a_c15t37 in the page rdp) and i want to assign individual labels for each observation, for example country names. how do i do that?

i have added country names to seperate observation labels and set each element in the scatterplot to show the observation label with a dot, but the result is that all observations write all the country names on top of each other.

can yo please show me how to label the observations properly?
sincerely
Thomas von Brasch
Attachments
oecd_hours_worked_total_engaged.wf1
(569.77 KiB) Downloaded 435 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Labels in scatterplot

Postby EViews Glenn » Mon Nov 18, 2013 2:55 pm

It appears that you have more than one observation with the same data values. How was your graph created?

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Re: Labels in scatterplot

Postby tvonbrasch » Tue Nov 19, 2013 1:27 am

Hi Glenn,

thanks for your reply. the plot were made by taking the mean across all observations. do i have to create series that are means first, and then create the scatterplot for one time period only?
e.g., genr m1=@mean(sm1), genr v1=@mean(sv1) and m2=@mean(sm2) and genr v2=@mean(sv2) and then, in one particular sample year (smpl year year) create the scatterplot graph a.scat(mult=p) m1 v1 m2 v2 ?

i have added a graph in the attached workfile called a_glenn with two observations in 2005. how can i make the label "Norway" for the blue dot, and "Denmark" for the red dot?
Thomas
Attachments
oecd_hours_worked_total_engaged.wf1
(676.69 KiB) Downloaded 477 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Labels in scatterplot

Postby EViews Glenn » Tue Nov 19, 2013 12:58 pm

If all you are plotting is a few points, you are better off putting them into a matrix, or since you want labeling, into a workfile of the appropriate dimension. The problem is that your calculation by its very nature has multiple observations with the same points, which is why the labeling is drawing on top if earlier points.

If you want to plot means by country in a scatterplot with country labels, you'll have to create a page with countries as the observation identifiers, where the series contain the mean values for the country. Our linking and match merging tools will allow you to do this pretty easily. You should take a look at the docs for guidance.

As to the new graph, I really can't tell how this one was created, but again to get country labels, you'll have to have a country page/workfile.

antipa
Posts: 14
Joined: Tue Apr 16, 2013 9:47 am

Labels in scatterplot

Postby antipa » Fri Jul 04, 2014 8:33 am

Dear all,

When producing scatter plots, I would like to add the regression equation along with the fit line. If possible, I would also like to rename my series when displayed in the scatter plot. The code line I use so far, is displayed below; i'd be great if you could let me know how to adjust it.


group scatter_gr1 gdp m3_yoy urate_yoy
scatter_gr1.scat(m) linefit

Thanks a lot in advance!

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

Re: Labels in scatterplot

Postby EViews Gareth » Fri Jul 04, 2014 6:41 pm

Change the displaynames of the series in the group prior to making the scatter plot.

Use linefit(leg=det)

antipa
Posts: 14
Joined: Tue Apr 16, 2013 9:47 am

Re: Labels in scatterplot

Postby antipa » Mon Jul 07, 2014 9:29 am

Thanks for your quick aswer
The displaynames part works perfectly. Even with scatter_gr1.scat(m) linefit (leg=det) I don't get the regression equation for each panel the scatterplot.

Thanks a lot in advance!

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

Re: Labels in scatterplot

Postby EViews Gareth » Mon Jul 07, 2014 9:44 am

Code: Select all

create u 15 series y=nrnd series x=nrnd group scatter_gr1 x y show scatter_gr1.scat(m) linefit(leg=det)

antipa
Posts: 14
Joined: Tue Apr 16, 2013 9:47 am

Re: Labels in scatterplot

Postby antipa » Mon Jul 07, 2014 9:57 am

thanks a lot, but this command works only when you have one single panel in our scatterplot. I have nine of them and would like to add the equation to each of them.

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

Re: Labels in scatterplot

Postby EViews Gareth » Mon Jul 07, 2014 10:44 am

You can only display the detailed legend if you have a single scatter plot.

antipa
Posts: 14
Joined: Tue Apr 16, 2013 9:47 am

Re: Labels in scatterplot

Postby antipa » Tue Jul 08, 2014 9:40 am

thanks!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests