I have a challenge in getting attribute maps to relate to markers symbols.
In the following graph I want different symbols for the group variables
I have an attribute set that contain the group as value, ID and Markercolor, linecolor and Marker symbol.
I've been using this blog as an example
https://blogs.sas.com/content/graphicallyspeaking/2012/02/27/roses-are-red-violets-are-blue/
However I do not get the markersymbol to work in the program below. If anybody can spot my mistake or another reason why this does not work I would be gratefull. I need to use an attribute map as I want the colors and symbols to be consitent with different subset of the lithography. There are no warnings in the log.
data WORK.PLOT;
infile datalines dsd truncover;
input New_name:$28. Factor2:32. Factor1:32. Variable:$5.;
datalines4;
CLAYSTONE,-0.185413784,0.8765300403,DEN
CLAYSTONE,0.0802383641,-0.942423341,DT
CLAYSTONE,0.0894057721,-0.914880023,DTS
CLAYSTONE,-0.136821684,0.8858383038,MD
CLAYSTONE,0.499795716,0.5467842298,rdep2
CLAYSTONE,0.8796590392,0.1908197143,RMED
SANDSTONE,-0.073826801,-0.810730681,DEN
SANDSTONE,0.0054279929,0.9557568336,DT
SANDSTONE,-0.008915198,0.9355992025,DTS
SANDSTONE,0.0206300191,-0.860819962,MD
SANDSTONE,0.7554762984,-0.022696386,rdep2
SANDSTONE,0.7646326321,-0.028504051,RMED
SANDY CLAYSTONE,-0.534628033,0.5768449572,DEN
SANDY CLAYSTONE,0.106994111,-0.886402929,DT
SANDY CLAYSTONE,0.3631873579,-0.808710324,DTS
SANDY CLAYSTONE,-0.908688287,0.1857373082,MD
SANDY CLAYSTONE,0.5436369576,0.7820378251,rdep2
SANDY CLAYSTONE,0.5483943704,0.8034061258,RMED
SILTY SANDSTONE,-0.053856972,0.8735052089,DEN
SILTY SANDSTONE,0.0412853994,-0.968138473,DT
SILTY SANDSTONE,0.0332220091,-0.956833223,DTS
SILTY SANDSTONE,-0.040747162,0.9220015982,MD
SILTY SANDSTONE,0.9423890513,0.0879985013,rdep2
SILTY SANDSTONE,0.9433741015,0.0778507436,RMED
;;;;
data LITH_ATTRIBUTES;
infile datalines dsd truncover;
input ID:$4. value:$28. Markercolor:$18. Linecolor:$18. Markersymbol:$25.;
datalines4;
lith,ANHYDRITE,BRPK,BRPK,Triangle
lith,CLAYSTONE,aquamarine,aquamarine,Diamondfilled
lith,COAL,DABGR,DABGR,Plus
lith,CONGLOMERATE,DarkGreen,DarkGreen,TriangleDownfilled
lith,CONGLOMERATE MUDDY SANDSTONE,DarkGreen,DarkGreen,CircleFilled
lith,DOLOMITIC LIMESTONE,BIO,BIO,HomeDownFilled
lith,HALITE,Beige,Beige,SquareFilled
lith,INTRUSIVE ROCK,VIV,VIV,TriangleLeftFilled
lith,LIMESTONE,BIPB,BIPB,TriangleFilled
lith,MARL,deepskyblue,deepskyblue,CircleFilled
lith,METAMORPHIC ROCKS,BIP,BIP,TriangleRightFilled
lith,MUDDY SANDSTONE,Brown,Brown,TriangleLeft
lith,SANDSTONE,chocolate,chocolate,CircleFilled
lith,SANDY CLAYSTONE,burlywood,burlywood,TriangleDownFilled
lith,SHALE,Olive,Olive,SquareFilled
lith,SILTSTONE,BRO,BRO,DiamondFilled
lith,SILTY CLAYSTONE,gold,gold,Starfilled
lith,SILTY SANDSTONE,BIGB,BIGB,Hash
lith,SILTY SHALE,blanchedalmond,blanchedalmond,Star
lith,UNKNOWN,salmon,salmon,TriangleRight
lith,VOLCANIC CLASTICS,crimson,crimson,IBeam
;;;;
ods graphics on / imagemap;
proc sgplot data=plot aspect=1 dattrmap=Lith_attributes;
scatter x=Factor1 y=Factor2/ group=New_name markerattrs=(symbol=circlefilled size=10 px) datalabel=variable attrid=lith;
refline 0 / axis=x;
refline 0 / axis=y;
xaxis min=-1 max=1;
yaxis min=-1 max=1;
run;
Also, be sure to use attrpriority=none when you want different markers (particularly when using an attrpriority=color style like htmlblue).
Thanks
Thanks a million. Three poeple here have looked at this and not seen the symbol=circlefilled. Removing and everything worked.
The reason it was there was form the first version before we decided we needed more symbols.
@PaalNavestad wrote:
Thanks a million. Three poeple here have looked at this and not seen the symbol=circlefilled. Removing and everything worked.
The reason it was there was form the first version before we decided we needed more symbols.
I find it easier to debug graphic problems when one option is on one line such as:
proc sgplot data=plot aspect=1 dattrmap=Lith_attributes; scatter x=Factor1 y=Factor2/ group=New_name markerattrs=(symbol=circlefilled size=10 px) datalabel=variable attrid=lith ; refline 0 / axis=x; refline 0 / axis=y; xaxis min=-1 max=1; yaxis min=-1 max=1; run;
Long lines of code may tend to obfuscate an option that doesn't appear in a "normal" length statement. Since there may be many graphic options on a single plot statement this is a tad easier to read. Also commenting out one option is easier.
Thanks ballardw. You are completly right. Just old bad habits I think in adding all in one line.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.