Scatterplot with scatter point size indicating number of observations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Scatterplot with scatter point size indicating number of observations

Ronald Fischer-7
Dear all,
is it possible to create a 2-dimensional scatterplot in SPSS18 or SPSS19 in
which two variables are plotted against each other and the size of the scatter
points varies depending on the value of a 3rd variable? I have the case where
a lot of points overlap and I need a way to graphically represent the number
of observations that make up each scatter point in the graph. Can this be done
in SPSS? If yes, can you point me to some syntax or website that describes it
in sufficient detail?

Many thanks in advance

ron

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Scatterplot with scatter point size indicating number of observations

ViAnn Beadle
You can do this with GPL. This example varies the size of the point by the
value of variable educ for a scatterplot of salary on the y-axis by jobtime
on the x-axis.

I pasted the basic two way syntax from Chart Builder and then added in the
size variable on the VARIABLES keyword, a DATA statement for the size
variable, a SCALE statement to control the minimum and maximum sizes for the
dots, and a GUIDE statement to provide a Legend for the boundary values for
the size variable.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobtime salary educ
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: jobtime=col(source(s), name("jobtime"))
  DATA: salary=col(source(s), name("salary"))
  DATA: educ=col(source(s), name("educ"))
  GUIDE: axis(dim(1), label("Months since Hire"))
  GUIDE: axis(dim(2), label("Current Salary"))
  SCALE: linear(aesthetic(aesthetic.size), aestheticMinimum(size."1px"),
              aestheticMaximum(size."10px"))
  GUIDE: legend(aesthetic(aesthetic.size), label("Years of Education"))
  ELEMENT: point(position(jobtime*salary), size(educ), color(color.black))
END GPL.

There also may be a Graphboard template to do this in 19 but I don't have it
installed to check.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ron
Fischer
Sent: Monday, April 23, 2012 10:31 AM
To: [hidden email]
Subject: Scatterplot with scatter point size indicating number of
observations

Dear all,
is it possible to create a 2-dimensional scatterplot in SPSS18 or SPSS19 in
which two variables are plotted against each other and the size of the
scatter points varies depending on the value of a 3rd variable? I have the
case where a lot of points overlap and I need a way to graphically represent
the number of observations that make up each scatter point in the graph. Can
this be done in SPSS? If yes, can you point me to some syntax or website
that describes it in sufficient detail?

Many thanks in advance

ron

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list of
commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD