R: multiple line chart via ChartBuilder

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

R: multiple line chart via ChartBuilder

Luca Meyer
Hello Tanya,

I think your file needs restructuring before it can be plotted the
multiple line chart. Here is a tested (SPSS 15) example assuming two
variables (V1 & V2) containing the data and one variable (CASEID)
identifying the cases:

/*** first some sample data ***/
DATA LIST FREE /CASEID V1 V2.
BEGIN DATA
1 10 20
2 15 25
3 20 40
4 15 20
5 10 5
END DATA.
EXE.

/*** then I obtain a file long-and-narrow from a short-and-wide ***/
VARSTOCASES /ID = CASEID1
 /MAKE Observations FROM V1 V2
 /INDEX = Variables(2)
 /KEEP =  CASEID
 /NULL = KEEP.

/*** finally the chart builder syntax ***/
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=CASEID Observations
Variables
  MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: CASEID=col(source(s), name("CASEID"), unit.category())
 DATA: Observations=col(source(s), name("Observations"), unit.
category())
 DATA: Variables=col(source(s), name("Variables"), unit.category())
 GUIDE: axis(dim(1), label("CASEID"))
 GUIDE: axis(dim(2), label("Observations"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label
("Variables"))
 SCALE: cat(dim(1))
 SCALE: cat(dim(2))
 SCALE: cat(aesthetic(aesthetic.color.interior))
 ELEMENT: line(position(CASEID*Observations), color.interior
(Variables), missing.wings())
END GPL.

HTH,
Luca

Mr. Luca MEYER
Market research, data analysis & more
www.lucameyer.com - Tel: +39.339.495.00.21


-----Messaggio originale-----
Da: SPSSX(r) Discussion [mailto:[hidden email]] Per conto di
Tanya Temkin
Inviato: mercoledì 12 settembre 2007 0.14
A: [hidden email]
Oggetto: multiple line chart via ChartBuilder

I'm using ChartBuilder for the 1st time (first time in two years of
SPSS I've had to use it!!) to build a line chart. Maybe I'm missing
something after reading the usual references, but I can't figure out
how to build a chart with two separate lines. Where do I specify the
variable whose two values are to be represented on each of the two
lines? I can't find this when I opt for the "multiple lines"  format.

Thanks for the push in the right direction...

Tanya

Tanya Temkin
Research Associate
AACC Reporting
Northern California Regional Office
The Permanente Medical Group
(510) 625-6680
TIE 8-428-6680


NOTICE TO RECIPIENT:  If you are not the intended recipient of this e-
mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents.  If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them.  Thank you.




____________________________________________________
Rendi Sicuro il tuo Pc con Norton Antivirus!
http://vas.tiscali.it/internet_security//