Simple Scatterplot

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

Simple Scatterplot

Fred Grehl
Hi all,

i'm using spss 16 and would like to plot a scatterplot with a scale time variable (Example: 24-Dec-07 10:48) on the first axis.
Each piont of time maps to a specific corresponding string which is on the second axis.

When using ChartBuilder the resulting scatterplot only displays the plotted pionts at 24-Dec-07 00:00, 25-Dec-07 00:00 and so on. All points of time between are also plotted at these piont of times.
For example
24-Dec-07 10:48, 24-Dec-07 17:48 is plotted at 25-Dec-07 00:00
and
25-Dec-07 08:12 is also plottet at 25-Dec-07 00:00.

I just want each point plotted at the point of time it occurs.

Please help.

Thanks in advance,
Fred
Reply | Threaded
Open this post in threaded view
|

Re: Simple Scatterplot

Jason Burke
Hi Fred,

I am using SPSS 16 and here is an example that works nicely for me,
using the sample SPSS data file called Employee Data:


COMPUTE date_time=$TIME.
COMPUTE date_time=date_time + RV.NORMAL(0,36000) .
FORMAT date_time (DATETIME20) .

GGRAPH
  /GRAPHDATASET NAME="data" VARIABLES=date_time jobcat
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("data"))
  DATA: date_time=col(source(s), name("date_time"))
  DATA: jobcat=col(source(s), name("jobcat"), unit.category())
  ELEMENT: point(position(date_time*jobcat))
  GUIDE: axis(dim(1), label("Incident Date"))
  GUIDE: axis(dim(2), label("Job Class"))
  SCALE: cat(dim(2), include("1", "2", "3"))
END GPL .

The things that may causing an undesired result is the range on the
date-time axis. The smaller the range, the greater the detail that is
revealed in the scale.

HTH


Jason


On 1/11/08, leChef1001 <[hidden email]> wrote:

> Hi all,
>
> i'm using spss 16 and would like to plot a scatterplot with a scale time
> variable (Example: 24-Dec-07 10:48) on the first axis.
> Each piont of time maps to a specific corresponding string which is on the
> second axis.
>
> When using ChartBuilder the resulting scatterplot only displays the plotted
> pionts at 24-Dec-07 00:00, 25-Dec-07 00:00 and so on. All points of time
> between are also plotted at these piont of times.
> For example
> 24-Dec-07 10:48, 24-Dec-07 17:48 is plotted at 25-Dec-07 00:00
> and
> 25-Dec-07 08:12 is also plottet at 25-Dec-07 00:00.
>
> I just want each point plotted at the point of time it occurs.
>
> Please help.
>
> Thanks in advance,
> Fred
>
> --
> View this message in context: http://www.nabble.com/Simple-Scatterplot-tp14748764p14748764.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Simple Scatterplot

Fred Grehl
Hi Jason,

Jason Burke wrote
Hi Fred,

I am using SPSS 16 and here is an example that works nicely for me,
using the sample SPSS data file called Employee Data:


COMPUTE date_time=$TIME.
COMPUTE date_time=date_time + RV.NORMAL(0,36000) .
FORMAT date_time (DATETIME20) .

GGRAPH
  /GRAPHDATASET NAME="data" VARIABLES=date_time jobcat
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("data"))
  DATA: date_time=col(source(s), name("date_time"))
  DATA: jobcat=col(source(s), name("jobcat"), unit.category())
  ELEMENT: point(position(date_time*jobcat))
  GUIDE: axis(dim(1), label("Incident Date"))
  GUIDE: axis(dim(2), label("Job Class"))
  SCALE: cat(dim(2), include("1", "2", "3"))
END GPL .
This example shows the same strange result.

Even when changing to a numeric variable on the second axis the problem still persists.

Example:
Variable: ID, Type: Numeric, Measure: Scale
Variable: Time, Type: Date, Measure: Scale

ID; Time
2.0; 24-Dec-2007 10:48
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 11:15
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:50
2.0; 25-Dec-2007 08:50
1.0; 25-Dec-2007 08:51

The result:
http://fdahl.de/f1.png

Jason Burke wrote
The things that may causing an undesired result is the range on the
date-time axis. The smaller the range, the greater the detail that is
revealed in the scale.
How to change the scale on a time axis?
Using ChartEditor i cannot specify a period of time as major increment,
for example so that a major tick appears every 5 minutes.


Thanks for help,
Fred


Jason Burke wrote
On 1/11/08, leChef1001 <leChef1001@web.de> wrote:
> Hi all,
>
> i'm using spss 16 and would like to plot a scatterplot with a scale time
> variable (Example: 24-Dec-07 10:48) on the first axis.
> Each piont of time maps to a specific corresponding string which is on the
> second axis.
>
> When using ChartBuilder the resulting scatterplot only displays the plotted
> pionts at 24-Dec-07 00:00, 25-Dec-07 00:00 and so on. All points of time
> between are also plotted at these piont of times.
> For example
> 24-Dec-07 10:48, 24-Dec-07 17:48 is plotted at 25-Dec-07 00:00
> and
> 25-Dec-07 08:12 is also plottet at 25-Dec-07 00:00.
>
> I just want each point plotted at the point of time it occurs.
>
> Please help.
>
> Thanks in advance,
> Fred
Reply | Threaded
Open this post in threaded view
|

Re: Simple Scatterplot

Peck, Jon
Are you sure that your variables are really scale?  The behavior you are getting suggests that they are being treated as categorical.

Try this GPL:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=time id MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: time=col(source(s), name("time"))
  DATA: id=col(source(s), name("id"))
  GUIDE: axis(dim(1), label("time"))
  GUIDE: axis(dim(2), label("id"))
  ELEMENT: point(position(time*id))
END GPL.

HTH,
Jon Peck

This example shows the same strange result.

Even when changing to a numeric variable on the second axis the problem
still persists.

Example:
Variable: ID, Type: Numeric, Measure: Scale
Variable: Time, Type: Date, Measure: Scale

ID; Time
2.0; 24-Dec-2007 10:48
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 11:15
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:50
2.0; 25-Dec-2007 08:50
1.0; 25-Dec-2007 08:51

The result:
http://fdahl.de/f1.png


Jason Burke wrote:
>
> The things that may causing an undesired result is the range on the
> date-time axis. The smaller the range, the greater the detail that is
> revealed in the scale.
>

How to change the scale on a time axis?
Using ChartEditor i cannot specify a period of time as major increment,
for example so that a major tick appears every 5 minutes.


Thanks for help,
Fred



Jason Burke wrote:

>
> On 1/11/08, leChef1001 <[hidden email]> wrote:
>> Hi all,
>>
>> i'm using spss 16 and would like to plot a scatterplot with a scale time
>> variable (Example: 24-Dec-07 10:48) on the first axis.
>> Each piont of time maps to a specific corresponding string which is on
>> the
>> second axis.
>>
>> When using ChartBuilder the resulting scatterplot only displays the
>> plotted
>> pionts at 24-Dec-07 00:00, 25-Dec-07 00:00 and so on. All points of time
>> between are also plotted at these piont of times.
>> For example
>> 24-Dec-07 10:48, 24-Dec-07 17:48 is plotted at 25-Dec-07 00:00
>> and
>> 25-Dec-07 08:12 is also plottet at 25-Dec-07 00:00.
>>
>> I just want each point plotted at the point of time it occurs.
>>
>> Please help.
>>
>> Thanks in advance,
>> Fred
>
>

--
View this message in context: http://www.nabble.com/Simple-Scatterplot-tp14748764p14756193.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

AW: Simple Scatterplot

la volta statistics
In reply to this post by Fred Grehl
Hi Fred

I am getting the same result as you, using the example Jason Burke provided.
However, if you change the format of the time variable such as:

FORMAT date_time (TIME8).

then the points appear in the correct position in the chart, -Only the date
is then not shown in the x-axis. I havn't figure out so far, how to format
the x-axis in a way that it provides the date an the time when the data
format in the data sheet is set to TIME8.
I am using SPSS 15 and the varaible date_time is set to scale.

Christian


-----Ursprungliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Fred Grehl
Gesendet: Freitag, 11. Januar 2008 15:22
An: [hidden email]
Betreff: Re: Simple Scatterplot


Hi Jason,


Jason Burke wrote:

>
> Hi Fred,
>
> I am using SPSS 16 and here is an example that works nicely for me,
> using the sample SPSS data file called Employee Data:
>
>
> COMPUTE date_time=$TIME.
> COMPUTE date_time=date_time + RV.NORMAL(0,36000) .
> FORMAT date_time (DATETIME20) .
>
> GGRAPH
>   /GRAPHDATASET NAME="data" VARIABLES=date_time jobcat
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("data"))
>   DATA: date_time=col(source(s), name("date_time"))
>   DATA: jobcat=col(source(s), name("jobcat"), unit.category())
>   ELEMENT: point(position(date_time*jobcat))
>   GUIDE: axis(dim(1), label("Incident Date"))
>   GUIDE: axis(dim(2), label("Job Class"))
>   SCALE: cat(dim(2), include("1", "2", "3"))
> END GPL .
>

This example shows the same strange result.

Even when changing to a numeric variable on the second axis the problem
still persists.

Example:
Variable: ID, Type: Numeric, Measure: Scale
Variable: Time, Type: Date, Measure: Scale

ID; Time
2.0; 24-Dec-2007 10:48
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 11:15
1.0; 24-Dec-2007 10:49
1.0; 24-Dec-2007 10:50
2.0; 25-Dec-2007 08:50
1.0; 25-Dec-2007 08:51

The result:
http://fdahl.de/f1.png


Jason Burke wrote:
>
> The things that may causing an undesired result is the range on the
> date-time axis. The smaller the range, the greater the detail that is
> revealed in the scale.
>

How to change the scale on a time axis?
Using ChartEditor i cannot specify a period of time as major increment,
for example so that a major tick appears every 5 minutes.


Thanks for help,
Fred



Jason Burke wrote:

>
> On 1/11/08, leChef1001 <[hidden email]> wrote:
>> Hi all,
>>
>> i'm using spss 16 and would like to plot a scatterplot with a scale time
>> variable (Example: 24-Dec-07 10:48) on the first axis.
>> Each piont of time maps to a specific corresponding string which is on
>> the
>> second axis.
>>
>> When using ChartBuilder the resulting scatterplot only displays the
>> plotted
>> pionts at 24-Dec-07 00:00, 25-Dec-07 00:00 and so on. All points of time
>> between are also plotted at these piont of times.
>> For example
>> 24-Dec-07 10:48, 24-Dec-07 17:48 is plotted at 25-Dec-07 00:00
>> and
>> 25-Dec-07 08:12 is also plottet at 25-Dec-07 00:00.
>>
>> I just want each point plotted at the point of time it occurs.
>>
>> Please help.
>>
>> Thanks in advance,
>> Fred
>
>

--
View this message in context:
http://www.nabble.com/Simple-Scatterplot-tp14748764p14756193.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Simple Scatterplot

Fred Grehl
In reply to this post by Peck, Jon
Peck, Jon wrote
Are you sure that your variables are really scale?  The behavior you are getting suggests that they are being treated as categorical.
The variable view says they are scale. So I think they are :-).
I'm using the evaluation version. Could that be the problem?

Peck, Jon wrote
Try this GPL:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=time id MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: time=col(source(s), name("time"))
  DATA: id=col(source(s), name("id"))
  GUIDE: axis(dim(1), label("time"))
  GUIDE: axis(dim(2), label("id"))
  ELEMENT: point(position(time*id))
END GPL.

HTH,
Jon Peck
That gives the same result.
Furthermore, exporting to .eps does not work. Only empty .eps files are created, png works.

Thanks,
Fred