Dear members,
I recently realized that the position of observations on the x-axis was modified according to the size specified in the markercharattrs option. It appears as a simple translation of the scatterplot from the right to the left as the size increases (I enclosed two graphs, with size=2 and size=20, respectively). I suppose there is a good reason for this happening (and I'd be grateful if you'd explain it to me) but I find this a very serious problem, as it can easily go unnoticed.
Regards,
proc sort data=anno1_itraxind ; by wood bois; run;
proc sgpanel data=anno1_itraxind noautolegend dattrmap=myattrmap;
format markersp $symbesp.;
panelby wood bois / rows=2 novarname headerattrs=(size=12) uniscale=column;
scatter x=x y=y / group=site attrid=myid name='a' markerchar=markersp markercharattrs=(Family="Arial Unicode MS" size=20) transparency=0.3;
rowaxis label="PC2" offsetmin=0 offsetmax=0 values=(-6 to 6 by 2) labelattrs=(size=14) valueattrs=(size=12);
colaxis label="PC1" offsetmin=0 offsetmax=0 values=(-6 to 6 by 2) labelattrs=(size=14) valueattrs=(size=12);
refline 0/ axis=x lineattrs=(pattern=1 thickness=1px color=black);
refline 0/ axis=y lineattrs=(pattern=1 thickness=1px color=black);
keylegend 'a' / title="" noborder;
run;
/*Try option "labelstrip"*/
proc sgplot data=sashelp.class;
scatter x=weight y=height/markerchar=name group=sex labelstrip;
run;
You should include the ODS destination statement and ODS Graphics options in effect. Better would be to include an actual data set we test code with.
The orientation of your attached PDF does not quite align with your description of "right to left" as the attachment has the image rotated in respect to the document layout, which also may have an impact.
Suggestion: use fewer points, modify the dattrmap to include two definitions of marker size and overlay the same data with the two different attribute maps (that is TWO scatter statements). Then you are displaying the same points in the same location and we don't have to deal with optical illusion effects that may be involved with moving eyes left/right to "see" if relative locations are the same.
Seems like this issue is.
offsetmin=0 offsetmax=0
Fiddle with those and see what happens.
/*Try option "labelstrip"*/
proc sgplot data=sashelp.class;
scatter x=weight y=height/markerchar=name group=sex labelstrip;
run;
Thank you very much, Ksharp, for this suggestion, which does indeed solve the problem.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.