Hi
Somehow I don't understand the SCALE statement in GGRAPH procedures. I want to draw a line graph over 4 time points split by treatment A and B (see syntax below). That works ok as long as I don't use a SCALE statement for the scale variable (Index1). However, when I use SCALE: linear(dim(2), min(0.0), max(8.0)) to specify a linear dimension scale between 0 to 8, the axis is correctly limited to the range 0 to 8 but the data points are now transformed and in a wrong locations. How would I limit the dim(2) to a certain range and keeping the values correct? And how do I have to understand the transformation 'SCALE: linear' is doing to the variable trans1? Thanks, Christian *Example. NEW FILE. DATASET CLOSE all. DATA LIST Free/id1(f8.0) Medi(f8.0) p01_pat(a5) Index1(f8.0) trans1(f8.2). BEGIN DATA 1 2 A-001 1 3.00 1 2 A-001 2 1.00 1 2 A-001 3 2.00 1 2 A-001 4 .50 2 1 A-002 1 1.50 2 1 A-002 2 4.00 2 1 A-002 3 2.00 2 1 A-002 4 1.00 END DATA. Var Label Medi 'Treatment'. Val Lable Medi 1 "A" 2 "B". * This first example works well but does not limit the range of dim(2). GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES = id1 Index1 trans1 Medi P01_pat MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL PAGE: begin(scale(1200px,600px)) SOURCE: s=userSource(id("graphdataset")) DATA: trans1 =col(source(s), name("trans1"), unit.category()) DATA: Medi =col(source(s), name("Medi"), unit.category()) DATA: Index1 =col(source(s), name("Index1"), unit.category()) DATA: id1 =col(source(s), name("id1"), unit.category()) DATA: P01_pat =col(source(s), name("P01_pat"), unit.category()) SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.red), ("2",color.blue))) GUIDE: text.title(label("Chart xyz\nMeasurments by Treatment")) GUIDE: axis(dim(1), label("Time points")) GUIDE: axis(dim(2), label("Some Scale")) ELEMENT: line(position(Index1*trans1), split(id1), color(Medi)) ELEMENT: point(position(Index1*trans1), split(id1), label(P01_pat), color(Medi)) PAGE: end() END GPL. * This example limits the range of dim(2) fom 0 to 8 but transforms the variable trans1. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES = id1 Index1 trans1 Medi P01_pat MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL PAGE: begin(scale(1200px,600px)) SOURCE: s=userSource(id("graphdataset")) DATA: trans1 =col(source(s), name("trans1"), unit.category()) DATA: Medi =col(source(s), name("Medi"), unit.category()) DATA: Index1 =col(source(s), name("Index1"), unit.category()) DATA: id1 =col(source(s), name("id1"), unit.category()) DATA: P01_pat =col(source(s), name("P01_pat"), unit.category()) SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.red), ("2",color.blue))) GUIDE: text.title(label("Chart xyz\nMeasurments by Treatment")) GUIDE: axis(dim(1), label("Time points")) GUIDE: axis(dim(2), label("Some Scale")) SCALE: linear(dim(2), min(0.0), max(8.0)) ELEMENT: line(position(Index1*trans1), split(id1), color(Medi)) ELEMENT: point(position(Index1*trans1), split(id1), label(P01_pat), color(Medi)) PAGE: end() END GPL. ******************************* la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 Ch-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:[hidden email] internet: http://www.lavolta.ch/ |
Your SCALE statement specifies a linear scale while your trans1 variable placed on that axis is declared as categorical. Just remove the unit.category() from the variable definition, and all will be well.
Regards, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics Sent: Thursday, April 19, 2007 6:57 AM To: [hidden email] Subject: [SPSSX-L] GGRAPH: What does the SCALE statement do to the data Hi Somehow I don't understand the SCALE statement in GGRAPH procedures. I want to draw a line graph over 4 time points split by treatment A and B (see syntax below). That works ok as long as I don't use a SCALE statement for the scale variable (Index1). However, when I use SCALE: linear(dim(2), min(0.0), max(8.0)) to specify a linear dimension scale between 0 to 8, the axis is correctly limited to the range 0 to 8 but the data points are now transformed and in a wrong locations. How would I limit the dim(2) to a certain range and keeping the values correct? And how do I have to understand the transformation 'SCALE: linear' is doing to the variable trans1? Thanks, Christian *Example. NEW FILE. DATASET CLOSE all. DATA LIST Free/id1(f8.0) Medi(f8.0) p01_pat(a5) Index1(f8.0) trans1(f8.2). BEGIN DATA 1 2 A-001 1 3.00 1 2 A-001 2 1.00 1 2 A-001 3 2.00 1 2 A-001 4 .50 2 1 A-002 1 1.50 2 1 A-002 2 4.00 2 1 A-002 3 2.00 2 1 A-002 4 1.00 END DATA. Var Label Medi 'Treatment'. Val Lable Medi 1 "A" 2 "B". * This first example works well but does not limit the range of dim(2). GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES = id1 Index1 trans1 Medi P01_pat MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL PAGE: begin(scale(1200px,600px)) SOURCE: s=userSource(id("graphdataset")) DATA: trans1 =col(source(s), name("trans1"), unit.category()) DATA: Medi =col(source(s), name("Medi"), unit.category()) DATA: Index1 =col(source(s), name("Index1"), unit.category()) DATA: id1 =col(source(s), name("id1"), unit.category()) DATA: P01_pat =col(source(s), name("P01_pat"), unit.category()) SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.red), ("2",color.blue))) GUIDE: text.title(label("Chart xyz\nMeasurments by Treatment")) GUIDE: axis(dim(1), label("Time points")) GUIDE: axis(dim(2), label("Some Scale")) ELEMENT: line(position(Index1*trans1), split(id1), color(Medi)) ELEMENT: point(position(Index1*trans1), split(id1), label(P01_pat), color(Medi)) PAGE: end() END GPL. * This example limits the range of dim(2) fom 0 to 8 but transforms the variable trans1. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES = id1 Index1 trans1 Medi P01_pat MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL PAGE: begin(scale(1200px,600px)) SOURCE: s=userSource(id("graphdataset")) DATA: trans1 =col(source(s), name("trans1"), unit.category()) DATA: Medi =col(source(s), name("Medi"), unit.category()) DATA: Index1 =col(source(s), name("Index1"), unit.category()) DATA: id1 =col(source(s), name("id1"), unit.category()) DATA: P01_pat =col(source(s), name("P01_pat"), unit.category()) SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.red), ("2",color.blue))) GUIDE: text.title(label("Chart xyz\nMeasurments by Treatment")) GUIDE: axis(dim(1), label("Time points")) GUIDE: axis(dim(2), label("Some Scale")) SCALE: linear(dim(2), min(0.0), max(8.0)) ELEMENT: line(position(Index1*trans1), split(id1), color(Medi)) ELEMENT: point(position(Index1*trans1), split(id1), label(P01_pat), color(Medi)) PAGE: end() END GPL. ******************************* la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 Ch-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:[hidden email] internet: http://www.lavolta.ch/ |
Free forum by Nabble | Edit this page |