Mars for male and venus for female characters as markers in scatterplots

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

Mars for male and venus for female characters as markers in scatterplots

Art Kendall
I am away from my PC at the moment.

In some contexts, the ♂ &#9794 (Mars) is used for males and

♀ &#9792 (Venus) is used for females.

In SPSS graphics is there a way to uses these as markers in scatterplots?



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Mars for male and venus for female characters as markers in scatterplots

PRogman
You can manually edit the shapes in the chart, unfortunately I cannot save
that change to template file (it just makes circles instead of mars/venus
markers when applied)

It works in syntax if you tweak the GPL code... depending on how often you
want it applied (my somewhat syntax style allows for easy adding or removing
a line or command...)

/PR

*demo data*.
MATRIX.
  COMPUTE x = MAKE(15,3,0).
  SAVE {x}
    /VARIABLES "Sex", "X", "Y"
    /OUTFILE   *.
END MATRIX.
COMPUTE sex = RV.BERNOULLI(0.5).
COMPUTE x   = RND(RV.UNIFORM(0,11)).
COMPUTE y   = RND(RV.UNIFORM(0,11)).
VARIABLE LEVEL x y (SCALE).
VALUE LABELS sex 0'Female' 1'Male'.
EXECUTE.

*Demo graph*.
GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES = X
               Y
               Sex
  /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:   Sex=col(source(s), name("Sex"), unit.category())
  SCALE:  cat(aesthetic(aesthetic.shape)
             ,map(("0", shape.female)
                 ,("1", shape.male)
                 )
             )
  GUIDE: legend(aesthetic(aesthetic.color)
               ,label("Sex")
               )
  SCALE:  cat(aesthetic(aesthetic.color)
             ,map(("0", color.red)
                 ,("1", color.blue)
                 )
             )
  GUIDE:  axis(dim(1), label("X"))
  GUIDE:  axis(dim(2), label("Y"))
  GUIDE:  text.title(label("Demo plot"))
  ELEMENT: point(position(X*Y)
                ,shape(Sex)
                ,color(Sex)
                ,size(size."10")
                )
END GPL.




Art Kendall wrote

> I am away from my PC at the moment.
>
> In some contexts, the ♂ &#9794 (Mars) is used for males and
>
> ♀ &#9792 (Venus) is used for females.
>
> In SPSS graphics is there a way to uses these as markers in scatterplots?
>
>
>
> -----
> Art Kendall
> Social Research Consultants
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





--
Sent from: http://spssx-discussion.1045642.n5.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: Mars for male and venus for female characters as markers in scatterplots

Art Kendall
Thanks, I'll give that a try.




-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Mars for male and venus for female characters as markers in scatterplots

Jon Peck
In reply to this post by PRogman
That doesn't use the symbols Art wanted in the chart, as far as I can see.

On Fri, Mar 19, 2021 at 1:29 PM PRogman <[hidden email]> wrote:
You can manually edit the shapes in the chart, unfortunately I cannot save
that change to template file (it just makes circles instead of mars/venus
markers when applied)

It works in syntax if you tweak the GPL code... depending on how often you
want it applied (my somewhat syntax style allows for easy adding or removing
a line or command...)

/PR

*demo data*.
MATRIX.
  COMPUTE x = MAKE(15,3,0).
  SAVE {x}
    /VARIABLES "Sex", "X", "Y"
    /OUTFILE   *.
END MATRIX.
COMPUTE sex = RV.BERNOULLI(0.5).
COMPUTE x   = RND(RV.UNIFORM(0,11)).
COMPUTE y   = RND(RV.UNIFORM(0,11)).
VARIABLE LEVEL x y (SCALE).
VALUE LABELS sex 0'Female' 1'Male'.
EXECUTE.

*Demo graph*.
GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES = X
               Y
               Sex
  /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:   Sex=col(source(s), name("Sex"), unit.category())
  SCALE:  cat(aesthetic(aesthetic.shape)
             ,map(("0", shape.female)
                 ,("1", shape.male)
                 )
             )
  GUIDE: legend(aesthetic(aesthetic.color)
               ,label("Sex")
               )
  SCALE:  cat(aesthetic(aesthetic.color)
             ,map(("0", color.red)
                 ,("1", color.blue)
                 )
             )
  GUIDE:  axis(dim(1), label("X"))
  GUIDE:  axis(dim(2), label("Y"))
  GUIDE:  text.title(label("Demo plot"))
  ELEMENT: point(position(X*Y)
                ,shape(Sex)
                ,color(Sex)
                ,size(size."10")
                )
END GPL.




Art Kendall wrote
> I am away from my PC at the moment.
>
> In some contexts, the ♂ &#9794 (Mars) is used for males and
>
> ♀ &#9792 (Venus) is used for females.
>
> In SPSS graphics is there a way to uses these as markers in scatterplots?
>
>
>
> -----
> Art Kendall
> Social Research Consultants
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[hidden email]

===================== 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: Mars for male and venus for female characters as markers in scatterplots

Andy W
Progman's solution will work if you do

FORMATS sex (F1.0).

Before you run his GGRAPH code example. GGRAPH inherits the decimal
formatting. So if you don't do that you would need to do:

SCALE:  cat(aesthetic(aesthetic.shape), map(("0.00", shape.female)
                 ,("1.00", shape.male)))

Or whatever the default decimal format is to get GGRAPH to map the right
aesthetics.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Mars for male and venus for female characters as markers in scatterplots

Andy W
And for others as well, the SPSS GPL Reference guide has a list of the
color/shape/pattern constants. (If you go to [Help -> Documentation in PDF
Format] it will have a mentioned GPL reference.)

For a crappy quick visual, I have on my blog post the colors and shapes,
https://andrewpwheeler.com/2016/04/26/shapes-colors-and-pattern-constants-in-spss-charts/.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Mars for male and venus for female characters as markers in scatterplots

PRogman
In reply to this post by Andy W
Nice!
I forgot that in my settings the default new variable has the format (F8.0).
GPL is quite picky with syntax and formats.
/PR


Andy W wrote

> Progman's solution will work if you do
>
> FORMATS sex (F1.0).
>
> Before you run his GGRAPH code example. GGRAPH inherits the decimal
> formatting. So if you don't do that you would need to do:
>
> SCALE:  cat(aesthetic(aesthetic.shape), map(("0.00", shape.female)
>                  ,("1.00", shape.male)))
>
> Or whatever the default decimal format is to get GGRAPH to map the right
> aesthetics.
> -----
> Andy W

> apwheele@

> http://andrewpwheeler.wordpress.com/
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





--
Sent from: http://spssx-discussion.1045642.n5.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: Mars for male and venus for female characters as markers in scatterplots

Art Kendall
Thank you.

My default format for new variables is F8.0.
I am running SPSS 27.0.1.0.
I just pasted the syntax into a new syntax window.

It worked.

Next week when I download SPSS 28 Beta, I'll give it a try.

Although they are hard to see at first in Andy's
https://andrewpwheeler.com/2016/04/26/shapes-colors-and-pattern-constants-in-spss-charts/.

the female symbol is on row 1, column 8.  The male symbol is at row 5,
column 7.




-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Mars for male and venus for female characters as markers in scatterplots

PRogman
SPSS does not support too many other alchemy/astrology symbols... :-)

If you actually want a specific character as a symbol you can use Andy's
trick with labels.
https://andrewpwheeler.com/2015/01/14/labeling-tricks-in-spss-plots/
To see where the points would be place a colon sign(:) after the ELEMENT in
the last GPL command.
Note that you need to reserve 3 characters for each strange unicode
character.
A small example again with the template file placed as a naughty inline
template (which makes it simple to change font size).
You will need to run in unicode mode and of course use a font that supports
the character.
/PR

*demo data*.
MATRIX.
  COMPUTE x = MAKE(15,3,0).
  SAVE {x}
    /VARIABLES "Sex", "X", "Y"
    /OUTFILE   *.
END MATRIX.
COMPUTE sex = RV.BERNOULLI(0.5).
COMPUTE x   = RND(RV.UNIFORM(0,11)).
COMPUTE y   = RND(RV.UNIFORM(0,11)).
VARIABLE LEVEL x y (SCALE).
VALUE LABELS sex 0'Female' 1'Male'.
STRING Marker (A6).
IF (Sex EQ 0) Marker = "♀☺".
IF (Sex EQ 1) Marker = "♂☻".
EXECUTE.

*Demo graph*.
GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES = X
               Y
               Sex
               Marker
  /GRAPHSPEC
   SOURCE    = INLINE
   INLINETEMPLATE =[
   +'<addDataLabels colorByMarker="false" hidden="false">'
   +  '<style color="#000000" font-size="12pt" padding="0px"
stroke-width="0.5pt" number="0" visible="visible"/>'
   +  '<style color="#ffffff" color2="transparent" coordinate="1" number="1"
visible="true"/>'
   +  '<labeling variable="legend1"/>'
   +'</addDataLabels>'
   ].
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA:   X=col(source(s), name("X"))
  DATA:   Y=col(source(s), name("Y"))
  DATA:   Sex=col(source(s), name("Sex"), unit.category())
  DATA:   Marker=col(source(s), name("Marker"), unit.category())
  GUIDE:  axis(dim(1), label("X"))
  GUIDE:  axis(dim(2), label("Y"))
  GUIDE:  text.title(label("Demo plot with character markers"))
  ELEMENT: polygon(position(X*Y)
                  ,transparency.exterior(transparency."1")
                  ,label(Marker)
                  )
COMMENT: Insert a colon sign after ELEMENT to activate point plotting
  ELEMENT point(position(X*Y)
                ,shape(shape.circle)
                )
END GPL.







--
Sent from: http://spssx-discussion.1045642.n5.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