LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 19 May 2006 10:40:42 -0400
Reply-To:     "Feinstein, Zachary" <ZFeinstein@HarrisInteractive.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Feinstein, Zachary" <ZFeinstein@HarrisInteractive.com>
Subject:      Re: How Can I Create a Scatterplot With Group Averages/Centroids
              Plotted and Labeled Within It? - Two Followups
Comments: To: "Beadle, ViAnn" <viann@spss.com>
Content-Type: text/plain; charset="us-ascii"

Thanks much. It worked. I also need to really check out the functionality of all the graphing capabilities in SPSS now too.

Zachary

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Beadle, ViAnn Sent: Thursday, May 18, 2006 8:42 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: How Can I Create a Scatterplot With Group Averages/Centroids Plotted and Labeled Within It? - Two Followups

the color differentiation comes from color(jobcat) as a function in this example. Try swapping the two color functions in the two elements, you should get all your points as blue and centroids with varying colors by region.

________________________________

From: SPSSX(r) Discussion on behalf of Feinstein, Zachary Sent: Thu 5/18/2006 6:04 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: How Can I Create a Scatterplot With Group Averages/Centroids Plotted and Labeled Within It? - Two Followups

That is some wonderful code. Thank you very much.

I do have two questions though. First, how did the code know to give a different color to each of the brand points? Second, would it be possible to revise the code in such a way so that the scatter of all the points comes out in a single standard color but the centroids each have different colors instead of the other way around?

Thank you.

Zachary

-----Original Message----- From: Peck, Jon [mailto:peck@spss.com] Sent: Monday, May 15, 2006 7:17 AM To: Feinstein, Zachary; SPSSX-L@LISTSERV.UGA.EDU Subject: RE: [SPSSX-L] How Can I Create a Scatterplot With Group Averages/Centroids Plotted and Labeled Within It?

There was a suggestion posted to use Igraph for this. If you want to use the standard graphics, you can do something like the code below, which is an example using the employee data.sav file shipped with SPSS. While there is more code in this example than you might expect, it illustrates the flexibility of GPL-based graphics. You can combine different graph elements in very flexible ways. This example combines a grouped scatterplot of salary and salbegin by jobcat with another scatterplot where the means have been calculated for each group and passed to the charting engine. That is, it has blended two different scatterplots that have compatible domains in one chart. I could have used any aggregation statistics in the same fashion.

If you are coming to our Directions conference in Barcelona, you can see me do this live and in color on Sunday in a preconference training class :-)

Regards, Jon Peck

* chart 11: A Simple Scatterplot with overlaid centroids. * Uses two datasets. get file="c:/spss14/employee data.sav". GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary jobcat /GRAPHDATASET NAME="graphdataset2" VARIABLES=jobcat mean(salbegin)[rename="mean_salbegin"] mean(salary)[rename="mean_salary"] /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salbegin=col(source(s), name("salbegin")) DATA: salary=col(source(s), name("salary")) DATA: jobcat=col(source(s), name("jobcat"),unit.category()) DATA: jobcatt=col(source(t), name("jobcat"),unit.category()) SOURCE: t=userSource(id("graphdataset2")) DATA: mean_salbegin=col(source(t), name("mean_salbegin")) DATA: mean_salary=col(source(t), name("mean_salary")) GUIDE: axis(dim(1), label("Beginning Salary")) GUIDE: axis(dim(2), label("Current Salary")) ELEMENT: point(position(salbegin*salary), color(jobcat)) ELEMENT: point(position(mean_salbegin*mean_salary),size(size."12px"), color(color.blue)) END GPL.

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Feinstein, Zachary Sent: Freitag, 12. Mai 2006 15:20 To: SPSSX-L@LISTSERV.UGA.EDU Subject: [SPSSX-L] How Can I Create a Scatterplot With Group Averages/Centroids Plotted and Labeled Within It?

I am using V14. I can easily do a scatterplot. I can also easily create a table of the groups I am interested in to get averages. Let's use regions (four of them) as an example- East, West, North, South.

I can do a table of var1 + var2 BY region then export the results to Excel and plot the points. This only does the averages though.

I'm interested in seeing the scatter of all the individual respondents, but then the averages/centroids plotted in there too (perhaps in a larger/more colorful symbol), and have the averages/centroids for each of the four regions labeled.

Can this easily be done with SPSS? Note that I use syntax.

Thank you in advance.

Zachary zfeinstein@harrisinteractive.com (763) 541-7161


Back to: Top of message | Previous page | Main SPSSX-L page