10-01-2014 10:39 AM
I've reviewed the SAS help for SGSCATTER and cannot find information on the following;
1) How to adjust the axes on the plot. I have two plots that I would like to have the same ranges for the X and Y axes.
2) Overlaying colored polygons. I'd like to shade different "zones" in my scatter plot. Perhaps SGSCATTER isn't the best procedure for this - if not, I'm open to other suggestions.
10-01-2014 11:33 AM
It will help if you can provide more information.
1. What release of SAS are you using?
2. Are you using SGSCATTER ot create a panel of comparative scatter plots, or just graphs with scatter plots.
3. Polygon plot (SAS 9.4M1) is not supported in SGSCATTER. You likely need to use SGAnnotate.
4. It would help if you attach your working code with some data.
10-01-2014 12:24 PM
1) I'm using SAS 9.4 for Windows.
2) I'm only using it to create graphs with scatter plots (not trying to put together more than one plot in a panel)
3) Thanks! I haven't used SGAnnotate before, but I'll look into it.
Below is an edited version of code I've used. I have already used uniscale=all, but this doesn't do what I'd like. I'd like to create two separate scatter plots (not a side-by-side comparison in a panel, but imagine a scatter plot created using the dataset "one" below and a second created using another dataset "two")--I'd like these plots to have the same ranges for the x and y axes.
input TYPE $ Xvalue Yvalue;
A 0 3.2
B 1.6 18.6
C 15.1 1.9
D 0 7.7
E 37.3 2.1
F 29.4 78
G 60.3 15.4
H 19.4 6.2
I 0 5.6
J 2.4 1.3
K 0 54
L 15.9 48.5
M 3.2 0
ods html style = journal;
ods graphics / width = 6in height = 6in;
proc sgscatter data = one;
plot Yvalue*Xvalue / group = TYPE
datalabel = TYPE
uniscale = ALL;
10-01-2014 01:06 PM
For this type of plot, you probably should not be using SGSCATTER. You should be using SGPLOT. SGSCATTER is designed to create panels of scatter plots, which is why you found the number of axis options limiting. SGPLOT will give you much more control for the "single-cell" plot you're creating. For example:
proc sgplot data = one noautolegend;
xaxis min=<min value> max=<max value>;
yaxis min=<min value> max=<max value>;
scatter y=Yvalue x=Xvalue / group = TYPE
datalabel = TYPE;
10-01-2014 01:13 PM
I was going to suggest the same, hence my questions. Additionally, if you want SGPLOT to make the axes uniform across both graphs, you could combine the data of "One" and "Two" in to one data set with a "BY" value, and then use the BY statement to output two separate graphs with uniform axes using the UNIFORM=SCALE option.
Also, with SGPLOT, you can use the POLYGON statement (SAS 9.4M1) to draw polygons instead of annotate.