getting a two series line graphs in one figure

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

getting a two series line graphs in one figure

s_pushparaj
I wanted to get two Interactive line graph which was generated using the following codes separately in one figure.

IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
  VAR(var00004) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE = LINE
  DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
EXE.
IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
  VAR(var00006) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE = LINE
  DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
EXE.

Help me generate these two or many lines graphs as one single figure.

with thanks
pushparaj
Reply | Threaded
Open this post in threaded view
|

Re: getting a two series line graphs in one figure

Marta Garcia-Granero
Hi Pushparaj:

If you want a dual Y axis graph (different scales in each one), then you
need to use GGRAPH (SPSS 15, the dual Y axis is not possible with SPSS
14, if I remember correctly). See an example at the end of this message.

> I wanted to get two Interactive line graph which was generated using the following codes separately in one figure.
>
> IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
>   VAR(var00004) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
>  /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE = LINE
>   DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
> EXE.
> IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
>   VAR(var00006) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
>  /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE = LINE
>   DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
> EXE.
>
> Help me generate these two or many lines graphs as one single figure.
>
Regards,
Marta Garcia-Granero

* Sample code: *.

DATA LIST LIST/Pprime(F4) R2 Rho2 ResSD (3 F8.3).
BEGIN DATA
  2 0.344 0.342 62.515
  3 0.459 0.457 56.808
  4 0.480 0.477 55.778
  5 0.492 0.487 55.197
  6 0.509 0.503 54.349
  7 0.515 0.509 54.031
  8 0.523 0.515 53.700
  9 0.528 0.519 53.440
 10 0.532 0.522 53.287
 11 0.534 0.523 53.255
 12 0.535 0.523 53.231
 13 0.537 0.524 53.199
 14 0.538 0.524 53.175
 15 0.540 0.525 53.154
 16 0.541 0.524 53.163
 17 0.542 0.524 53.167
 18 0.542 0.524 53.199
 19 0.542 0.523 53.255
 20 0.542 0.522 53.313
END DATA.
VAR LABEL Pprime'P*=p+1'/R2'R²'/Rho2'Adj.R²'ResSD'Residual SD'.

* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Pprime MEAN(Rho2)[name=
  "MEAN_Rho2"] MEAN(ResSD)[name="MEAN_ResSD"]
  MISSING=LISTWISE
  REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Pprime=    col(source(s), name("Pprime"))
 DATA: MEAN_Rho2= col(source(s), name("MEAN_Rho2"))
 DATA: MEAN_ResSD=col(source(s), name("MEAN_ResSD"))
 GUIDE: axis(dim(1), label("P*=p+1"))
 GUIDE: axis(scale(y1), label("R²(adjusted)"),  color(color."3E58AC"))
 GUIDE: axis(scale(y2), label("Res(SD)"), color(color."2EB848"), opposite())
 SCALE: y1 = linear(dim(2))
 SCALE: y2 = linear(dim(2))
 ELEMENT: point(position(Pprime*MEAN_Rho2),  color.exterior(color."3E58AC")
  , scale(y1))
 ELEMENT: point(position(Pprime*MEAN_ResSD), color.exterior(color."2EB848")
  , scale(y2))
END GPL.
Reply | Threaded
Open this post in threaded view
|

Re: getting a two series line graphs in one figure

Marta Garcia-Granero
To the list, please
> Dear Madam
>
> I am trying to fit two line graphs or an ordinary Multiple line graph.
> I am having a processed data. So I wish to draw a line graph for the
> value as such. ( No graph on any statistic value like mean, sd or
> variance). Your suggestion is for a generalised graph but again
> specifically it is taking mean values for a variable. Kindly help me
> solve the problem. (Kinly pardon me for not being specific in my
> question in my earlier request)

The mean of one data is the data itself, I'm not plotting means, but
processed data, like yourself. I have labelled the values Means and SD
because they are summary measures (obtained from previous (and long)
code I have not included. Try the code, and you will see that it plots
together both series of individual data.

Regards,
Marta

>>>
>>> Help me generate these two or many lines graphs as one single figure.
>>>
>> Regards,
>> Marta Garcia-Granero
>>
>> * Sample code: *.
>>
>> DATA LIST LIST/Pprime(F4) R2 Rho2 ResSD (3 F8.3).
>> BEGIN DATA
>>  2 0.344 0.342 62.515
>>  3 0.459 0.457 56.808
>>  4 0.480 0.477 55.778
>>  5 0.492 0.487 55.197
>>  6 0.509 0.503 54.349
>>  7 0.515 0.509 54.031
>>  8 0.523 0.515 53.700
>>  9 0.528 0.519 53.440
>> 10 0.532 0.522 53.287
>> 11 0.534 0.523 53.255
>> 12 0.535 0.523 53.231
>> 13 0.537 0.524 53.199
>> 14 0.538 0.524 53.175
>> 15 0.540 0.525 53.154
>> 16 0.541 0.524 53.163
>> 17 0.542 0.524 53.167
>> 18 0.542 0.524 53.199
>> 19 0.542 0.523 53.255
>> 20 0.542 0.522 53.313
>> END DATA.
>> VAR LABEL Pprime'P*=p+1'/R2'R²'/Rho2'Adj.R²'ResSD'Residual SD'.
>>
>> * Chart Builder.
>> GGRAPH
>>  /GRAPHDATASET NAME="graphdataset" VARIABLES=Pprime MEAN(Rho2)[name=
>>  "MEAN_Rho2"] MEAN(ResSD)[name="MEAN_ResSD"]
>>  MISSING=LISTWISE
>>  REPORTMISSING=NO
>> /GRAPHSPEC SOURCE=INLINE.
>> BEGIN GPL
>> SOURCE: s=userSource(id("graphdataset"))
>> DATA: Pprime=    col(source(s), name("Pprime"))
>> DATA: MEAN_Rho2= col(source(s), name("MEAN_Rho2"))
>> DATA: MEAN_ResSD=col(source(s), name("MEAN_ResSD"))
>> GUIDE: axis(dim(1), label("P*=p+1"))
>> GUIDE: axis(scale(y1), label("R²(adjusted)"),  color(color."3E58AC"))
>> GUIDE: axis(scale(y2), label("Res(SD)"), color(color."2EB848"),
>> opposite())
>> SCALE: y1 = linear(dim(2))
>> SCALE: y2 = linear(dim(2))
>> ELEMENT: point(position(Pprime*MEAN_Rho2),
>> color.exterior(color."3E58AC")
>>  , scale(y1))
>> ELEMENT: point(position(Pprime*MEAN_ResSD),
>> color.exterior(color."2EB848")
>>  , scale(y2))
>> END GPL.
>>
> Hi Pushparaj:
>
>
Reply | Threaded
Open this post in threaded view
|

Re: getting a two series line graphs in one figure

ViAnn Beadle
In reply to this post by s_pushparaj
Is there some reason why you require this be done with the IGRAPH command?
You can do this with a GRAPH command (Graph>Line) or Chart Builder.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
s_pushparaj
Sent: Wednesday, September 05, 2007 12:43 AM
To: [hidden email]
Subject: getting a two series line graphs in one figure

I wanted to get two Interactive line graph which was generated using the
following codes separately in one figure.

IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
  VAR(var00004) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE =
LINE
  DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
EXE.
IGRAPH /VIEWNAME='Line Chart' /X1 = VAR(var00003) TYPE = SCALE /Y =
  VAR(var00006) TYPE = SCALE /COORDINATE = VERTICAL  /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /LINE(MEAN) KEY=ON STYLE =
LINE
  DROPLINE = OFF INTERPOLATE = SPLINE BREAK = MISSING.
EXE.

Help me generate these two or many lines graphs as one single figure.

with thanks
pushparaj
Reply | Threaded
Open this post in threaded view
|

Using GPL create dual axis for each column of data

Eric Spriggs
In reply to this post by Marta Garcia-Granero
Hello,

I want to be able to use syntax to create all the dual y axis bar charts so that I do not have to go one by one.  Here is what I try but on the second chart it says that I have to rerun the ggraph procedure. How do I use on GGRAPH procedure to create multiple charts for each column of data.

 GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Questions MEAN(Alaska)[name="MEAN_Alaska"]
      MEAN(National)[name="MEAN_National"]
      MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
 BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Questions=col(source(s), name("Questions"), unit.category())
 DATA: Questions=col(source(s), name("Questions"), unit.category())
 DATA: MEAN_Alaska=col(source(s), name("MEAN_Alaska"))
 DATA: MEAN_National=col(source(s), name("MEAN_National"))
 GUIDE: axis(dim(1), label("Questions"))
 GUIDE: axis(scale(y1), delta(1), label("Mean Alaska"), color(  color."3E58AC"))
 GUIDE: axis(scale(y2), delta(1), label("Mean National"), color(  color."2EB848"), opposite())
 SCALE: cat(dim(1))
 SCALE: y1 = linear(dim(2), min(1), max(5), origin(1))
 SCALE: y2 = linear(dim(2), min(1), max(5), origin(1))
 ELEMENT: interval(position(Questions*MEAN_Alaska), shape.interior(  shape.square), color.interior(color."3E58AC"), scale(y1))
 ELEMENT: line(position(Questions*MEAN_National), missing.wings(),  color.interior(color."2EB848"), scale(y2))
 END GPL.
 BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Questions=col(source(s), name("Questions"), unit.category())
 DATA: Questions=col(source(s), name("Questions"), unit.category())
 DATA: MEAN_Alaska=col(source(s), name("MEAN_Alaska"))
 DATA: MEAN_National=col(source(s), name("MEAN_National"))
 GUIDE: axis(dim(1), label("Questions"))
 GUIDE: axis(scale(y1), delta(1), label("Mean Alaska"), color(  color."3E58AC"))
 GUIDE: axis(scale(y2), delta(1), label("Mean National"), color(  color."2EB848"), opposite())
 SCALE: cat(dim(1))
 SCALE: y1 = linear(dim(2), min(1), max(5), origin(1))
 SCALE: y2 = linear(dim(2), min(1), max(5), origin(1))
 ELEMENT: interval(position(Questions*MEAN_Alaska), shape.interior(  shape.square), color.interior(color."3E58AC"), scale(y1))
 ELEMENT: line(position(Questions*MEAN_National), missing.wings(),  color.interior(color."2EB848"), scale(y2))
 END GPL.