Multiple line graphs using 15

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

Multiple line graphs using 15

Lemon, John S.
I am trying to help a student graph the following data and I cannot see
the correct way getting a multiple line graph with two y axis. The data
represents the value of the stock exchange ( FTSE ) and of a number of
different firms and the idea is to see whether interactions between the
value of the FTSE and takeover bids affected the different firms. I can
use the legacy dialogs to create a chart with all the lines on the one
graph - but because the FTSE has a much higher value the information for
the firms is 'squashed' down at the bottom. Deally I would like the FTSE
to be on one X-axis and the firms on another. In both cases using the
optimum scaling to avoid the 'squashing'.
 
Date            ftse       firm1   firm2    firm3    firm4
01.01.2003 1893.76 391.00 452.50 305.78 360.00
02.01.2003 1923.58 391.50 457.50 310.42 364.00
03.01.2003 1923.75 399.50 465.50 310.42 369.00
06.01.2003 1921.53 408.00 465.50 302.95 368.50
07.01.2003 1903.19 402.00 464.50 301.40 366.00
08.01.2003 1888.31 398.00 463.50 298.82 356.00
09.01.2003 1892.90 392.00 469.50 297.79 361.50
 
I'll keep experimenting but I cannot see how to get chart builder to
accept two y axis !!
 
Best Wishes and thanks
 
John S. Lemon
DIT - University of Aberdeen
Edward Wright Building
<http://www.abdn.ac.uk/central/vcampus/kings/edward.shtml> : Room G51
Tel:  +44 1224 273350
Fax: +44 1224 273372
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Multiple line graphs using 15

Beadle, ViAnn
I'm not sure how you want to divvy up the axes here. What goes on y1, y2, and x. You mention lines. Do you want those elements for y1 by x and y2 by x? You have to have two elements for a dual y chart and there are some restrictions on the types of aggregation for each set. More details please.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lemon, John S.
Sent: Tuesday, April 10, 2007 6:15 AM
To: [hidden email]
Subject: Multiple line graphs using 15

I am trying to help a student graph the following data and I cannot see
the correct way getting a multiple line graph with two y axis. The data
represents the value of the stock exchange ( FTSE ) and of a number of
different firms and the idea is to see whether interactions between the
value of the FTSE and takeover bids affected the different firms. I can
use the legacy dialogs to create a chart with all the lines on the one
graph - but because the FTSE has a much higher value the information for
the firms is 'squashed' down at the bottom. Deally I would like the FTSE
to be on one X-axis and the firms on another. In both cases using the
optimum scaling to avoid the 'squashing'.

Date            ftse       firm1   firm2    firm3    firm4
01.01.2003 1893.76 391.00 452.50 305.78 360.00
02.01.2003 1923.58 391.50 457.50 310.42 364.00
03.01.2003 1923.75 399.50 465.50 310.42 369.00
06.01.2003 1921.53 408.00 465.50 302.95 368.50
07.01.2003 1903.19 402.00 464.50 301.40 366.00
08.01.2003 1888.31 398.00 463.50 298.82 356.00
09.01.2003 1892.90 392.00 469.50 297.79 361.50

I'll keep experimenting but I cannot see how to get chart builder to
accept two y axis !!

Best Wishes and thanks

John S. Lemon
DIT - University of Aberdeen
Edward Wright Building
<http://www.abdn.ac.uk/central/vcampus/kings/edward.shtml> : Room G51
Tel:  +44 1224 273350
Fax: +44 1224 273372
Reply | Threaded
Open this post in threaded view
|

Re: Multiple line graphs using 15

Lemon, John S.
In reply to this post by Lemon, John S.
ViAnn

Thanks for your help.

The student wants the date to be the X-axis, FTSE to be the 'left' Y
axis and all the firms to appear as multiple lines on the 'right' Y
axis. If you look at http://www.abdn.ac.uk/~com045/multlines.pdf then
you can see the current graph obtained with the legacy dialog but the
effect of the greater value for FTSE prevents the trends for the forms
being seen.

Best Wishes

John S. Lemon
DIT - University of Aberdeen
Edward Wright Building: Room G51
Tel:  +44 1224 273350
Fax: +44 1224 273372



> -----Original Message-----
> From: Beadle, ViAnn [mailto:[hidden email]]
> Sent: Tuesday, April 10, 2007 12:31 PM
> To: Lemon, John S.
> Cc: [hidden email]
> Subject: RE: Multiple line graphs using 15
>
> I'm not sure how you want to divvy up the axes here. What
> goes on y1, y2, and x. You mention lines. Do you want those
> elements for y1 by x and y2 by x? You have to have two
> elements for a dual y chart and there are some restrictions
> on the types of aggregation for each set. More details please.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]
> On Behalf Of Lemon, John S.
> Sent: Tuesday, April 10, 2007 6:15 AM
> To: [hidden email]
> Subject: Multiple line graphs using 15
>
> I am trying to help a student graph the following data and I
> cannot see
> the correct way getting a multiple line graph with two y
> axis. The data
> represents the value of the stock exchange ( FTSE ) and of a number of
> different firms and the idea is to see whether interactions
> between the
> value of the FTSE and takeover bids affected the different
> firms. I can
> use the legacy dialogs to create a chart with all the lines on the one
> graph - but because the FTSE has a much higher value the
> information for
> the firms is 'squashed' down at the bottom. Deally I would
> like the FTSE
> to be on one X-axis and the firms on another. In both cases using the
> optimum scaling to avoid the 'squashing'.
>
> Date            ftse       firm1   firm2    firm3    firm4
> 01.01.2003 1893.76 391.00 452.50 305.78 360.00
> 02.01.2003 1923.58 391.50 457.50 310.42 364.00
> 03.01.2003 1923.75 399.50 465.50 310.42 369.00
> 06.01.2003 1921.53 408.00 465.50 302.95 368.50
> 07.01.2003 1903.19 402.00 464.50 301.40 366.00
> 08.01.2003 1888.31 398.00 463.50 298.82 356.00
> 09.01.2003 1892.90 392.00 469.50 297.79 361.50
>
> I'll keep experimenting but I cannot see how to get chart builder to
> accept two y axis !!
>
> Best Wishes and thanks
>
> John S. Lemon
> DIT - University of Aberdeen
> Edward Wright Building
> <http://www.abdn.ac.uk/central/vcampus/kings/edward.shtml> : Room G51
> Tel:  +44 1224 273350
> Fax: +44 1224 273372
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple line graphs using 15

Beadle, ViAnn
There are two characteristics here that make this a bit difficult:

1. Chart Builder doesn't support dual-y charts in which one y has a single variable while the other y has multiple variables because of the approach it takes to summaries of separate variables.
2. Chart Builder relies upon color coding the axis to the element so that you can tell to which axis a variable is assigned. We can't do that here because we have multiple lines on one axis and they are distinguished by different colors. The default template makes ftse yellow so I explicitly set its color to black.

So, I made both axes black and added scale text to indicate what was what.

Here's my complete syntax for this:
data list list / Date (edate10)           ftse       firm1   firm2    firm3    firm4.
begin data
01.01.2003 1893.76 391.00 452.50 305.78 360.00
 02.01.2003 1923.58 391.50 457.50 310.42 364.00
 03.01.2003 1923.75 399.50 465.50 310.42 369.00
 06.01.2003 1921.53 408.00 465.50 302.95 368.50
 07.01.2003 1903.19 402.00 464.50 301.40 366.00
 08.01.2003 1888.31 398.00 463.50 298.82 356.00
 09.01.2003 1892.90 392.00 469.50 297.79 361.50
end data.

* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Date ftse firm1
 firm2 firm3 firm4 MISSING=
  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Date=col(source(s), name("Date"), unit.category())
 DATA: ftse=col(source(s), name("ftse"))
 DATA: firm1=col(source(s), name("firm1"))
 DATA: firm2=col(source(s), name("firm2"))
 DATA: firm3=col(source(s), name("firm3"))
 DATA: firm4=col(source(s), name("firm4"))
 GUIDE: axis(dim(1), label("Date"))
 GUIDE: axis(scale(y1), label("ftse"))
 GUIDE: axis(scale(y2), label("firms"), opposite())
 SCALE: cat(dim(1))
 SCALE: y1 = linear(dim(2))
 SCALE: y2 = linear(dim(2))
 ELEMENT: line(position(Date*ftse), color(color.black),
  scale(y1))
 ELEMENT: line(position(Date*firm1), color("firm1"),
  scale(y2))
 ELEMENT: line(position(Date*firm2), color("firm2"),
  scale(y2))
 ELEMENT: line(position(Date*firm3), color("firm3"),
  scale(y2))
 ELEMENT: line(position(Date*firm4), color("firm4"),
  scale(y2))
END GPL.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lemon, John S.
Sent: Tuesday, April 10, 2007 6:42 AM
To: [hidden email]
Subject: Re: Multiple line graphs using 15

ViAnn

Thanks for your help.

The student wants the date to be the X-axis, FTSE to be the 'left' Y
axis and all the firms to appear as multiple lines on the 'right' Y
axis. If you look at http://www.abdn.ac.uk/~com045/multlines.pdf then
you can see the current graph obtained with the legacy dialog but the
effect of the greater value for FTSE prevents the trends for the forms
being seen.

Best Wishes

John S. Lemon
DIT - University of Aberdeen
Edward Wright Building: Room G51
Tel:  +44 1224 273350
Fax: +44 1224 273372



> -----Original Message-----
> From: Beadle, ViAnn [mailto:[hidden email]]
> Sent: Tuesday, April 10, 2007 12:31 PM
> To: Lemon, John S.
> Cc: [hidden email]
> Subject: RE: Multiple line graphs using 15
>
> I'm not sure how you want to divvy up the axes here. What
> goes on y1, y2, and x. You mention lines. Do you want those
> elements for y1 by x and y2 by x? You have to have two
> elements for a dual y chart and there are some restrictions
> on the types of aggregation for each set. More details please.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]
> On Behalf Of Lemon, John S.
> Sent: Tuesday, April 10, 2007 6:15 AM
> To: [hidden email]
> Subject: Multiple line graphs using 15
>
> I am trying to help a student graph the following data and I
> cannot see
> the correct way getting a multiple line graph with two y
> axis. The data
> represents the value of the stock exchange ( FTSE ) and of a number of
> different firms and the idea is to see whether interactions
> between the
> value of the FTSE and takeover bids affected the different
> firms. I can
> use the legacy dialogs to create a chart with all the lines on the one
> graph - but because the FTSE has a much higher value the
> information for
> the firms is 'squashed' down at the bottom. Deally I would
> like the FTSE
> to be on one X-axis and the firms on another. In both cases using the
> optimum scaling to avoid the 'squashing'.
>
> Date            ftse       firm1   firm2    firm3    firm4
> 01.01.2003 1893.76 391.00 452.50 305.78 360.00
> 02.01.2003 1923.58 391.50 457.50 310.42 364.00
> 03.01.2003 1923.75 399.50 465.50 310.42 369.00
> 06.01.2003 1921.53 408.00 465.50 302.95 368.50
> 07.01.2003 1903.19 402.00 464.50 301.40 366.00
> 08.01.2003 1888.31 398.00 463.50 298.82 356.00
> 09.01.2003 1892.90 392.00 469.50 297.79 361.50
>
> I'll keep experimenting but I cannot see how to get chart builder to
> accept two y axis !!
>
> Best Wishes and thanks
>
> John S. Lemon
> DIT - University of Aberdeen
> Edward Wright Building
> <http://www.abdn.ac.uk/central/vcampus/kings/edward.shtml> : Room G51
> Tel:  +44 1224 273350
> Fax: +44 1224 273372
>
>
>