specifying shapes and colors for groups in IGRAPH and GGRAPH

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

specifying shapes and colors for groups in IGRAPH and GGRAPH

xenia
Hello all,
I know that IGRAPH will be removed in the next version of spss, but can anyone tell me how to change the shape of the points in a scatterplot from dots to stars, using IGRAPH syntax?
Also, using GGRAPH syntax, it is possible to present a graph using e.g. different colors for two levels of a categorical variable, but spss will use two different colors automatically. How can I specify in the syntax that I want e.g. green for males and orange for females?
I know creating a template and applying it is a solution, but I was wondering if it can be done through syntax.

thank you
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

Albert-Jan Roskam
> Sent: Wednesday, February 27, 2013 11:58 AM
> Subject: [SPSSX-L] specifying shapes and colors for groups in IGRAPH and GGRAPH
>
> Hello all,
> I know that IGRAPH will be removed in the next version of spss, but can
> anyone tell me how to change the shape of the points in a scatterplot from
> dots to stars, using IGRAPH syntax?
> Also, using GGRAPH syntax, it is possible to present a graph using e.g.
> different colors for two levels of a categorical variable, but spss will use
> two different colors automatically. How can I specify in the syntax that I
> want e.g. green for males and orange for females?
> I know creating a template and applying it is a solution, but I was
> wondering if it can be done through syntax.
>
> thank you

hi Xenia,

There is a little program that comes with spss, called syntaxconvert.exe, that can be used to convert
tables to ctables, igraph to ggraph. As for the second point: perhaps you should specify a VARIABLE LEVEL
other than scale, ie. nominal or ordinal.

Regards,
Albert-Jan

=====================
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: specifying shapes and colors for groups in IGRAPH and GGRAPH

xenia
Thank you, however whatever type variable one specifies spss will choose the color. My question is how can I, not spss, specify in the syntax the color or shape that I want for each group. E.g. I want males to be presented as green squares, females as red stars. How do I link in the syntax the male level of variable gender with the green color and the square shape etc.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

Jon K Peck
First, note that IGRAPH is NOT going away.  The command was rebuilt a few releases ago to use the Viz engine, but it is not being removed.

Given that, I would expect that the preference settings for the graphics cycle through color settings would apply here.  So start at Edit > Options > Charts > Style Cycles Colors.  Similarly for other preference settings.

Caveat:  I haven't actually tried this.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        xenia <[hidden email]>
To:        [hidden email],
Date:        02/27/2013 09:37 AM
Subject:        Re: [SPSSX-L] specifying shapes and colors for groups in IGRAPH              and GGRAPH
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Thank you, however whatever type variable one specifies spss will choose the
color. My question is how can I, not spss, specify in the syntax the color
or shape that *I want* for each group. E.g. I want males to be presented as
green squares, females as red stars. How do I link in the syntax the male
level of variable gender with the green color and the square shape etc.

Thank you



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/specifying-shapes-and-colors-for-groups-in-IGRAPH-and-GGRAPH-tp5718270p5718273.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


Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

Art Kendall
In reply to this post by xenia
on a data or syntax window click <edit> <options><charts> (<colors>,<markers>).
Art Kendall
Social Research Consultants
On 2/27/2013 11:27 AM, xenia wrote:
Thank you, however whatever type variable one specifies spss will choose the
color. My question is how can I, not spss, specify in the syntax the color
or shape that *I want* for each group. E.g. I want males to be presented as
green squares, females as red stars. How do I link in the syntax the male
level of variable gender with the green color and the square shape etc.

Thank you



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/specifying-shapes-and-colors-for-groups-in-IGRAPH-and-GGRAPH-tp5718270p5718273.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

xenia
Thank you,
however, I'd like to be able to do that by writing code in the syntax window, not by going into Options and changing things interactively.
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

David Marso
Administrator
No Joy!
You will likely need to design these using templates and then
SET CTEMPLATE = "some file containing template".
--
xenia wrote
Thank you,
however, I'd like to be able to do that by writing code in the syntax window, not by going into Options and changing things interactively.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

xenia

thank you
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

Andy W
In reply to this post by xenia
Here is an example in GGRAPH using map statements to assign particular categories to shapes and colors. I don't see any reason to prefer IGRAPH, and here is some more discussion of what mapping statements are in the grammar of graphics (http://spssx-discussion.1045642.n5.nabble.com/Manually-adding-legend-in-GPL-td5714324.html#a5714343).

*****************************************.
input program.
loop #i = 1 to 30.
compute X = RV.NORMAL(0,1).
compute Y = RV.NORMAL(0,1).
compute cat1 = TRUNC(RV.UNIFORM(1,3)).
compute cat2 = TRUNC(RV.UNIFORM(1,3)).
end case.
end loop.
end file.
end input program.
dataset name sim.
exe.


* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X Y cat1 cat2
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: X=col(source(s), name("X"))
 DATA: Y=col(source(s), name("Y"))
 DATA: cat1=col(source(s), name("cat1"), unit.category())
 DATA: cat2=col(source(s), name("cat2"), unit.category())
 GUIDE: axis(dim(1), label("X"))
 GUIDE: axis(dim(2), label("Y"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label("cat1"))
 SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.blue),("2",color.green)))
 SCALE: cat(aesthetic(aesthetic.shape), map(("1",shape.square),("2",shape.star)))
 ELEMENT: point(position(X*Y), color.interior(cat1), shape(cat2))
END GPL.
*****************************************.

Changing default shapes or colors in templates is pretty easy, it is harder to get it to apply consistently to different types of charts.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: specifying shapes and colors for groups in IGRAPH and GGRAPH

xenia
oh, this is great, will give it a try,
thank you