Posted by
PRogman on
URL: http://spssx-discussion.165.s1.nabble.com/Mars-for-male-and-venus-for-female-characters-as-markers-in-scatterplots-tp5740332p5740340.html
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