- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-25-2011 01:05 PM
(9875 views)
How can I add the y=x line to my scatter plots?
Thanks
Thanks
6 REPLIES 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is this for proc gplot? I think the simplest way is to use the overlay option and plot one variable against itself.
proc gplot data=dataset;
plot y*x x*x/overlay;
run;
You could also create another dummy variable that spans the x/y axis in case there isn't enough variability in x or y.
Using an annotated dataset would also work.
proc gplot data=dataset;
plot y*x x*x/overlay;
run;
You could also create another dummy variable that spans the x/y axis in case there isn't enough variability in x or y.
Using an annotated dataset would also work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I just meant is there a way to plot a reference line with 0 intercept and slope = 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to make agreement plots without using the Ttest procedure in GPLOT or SGPLOT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Right, plotting any variable against itself is a line with an intercept at 0 and slope of 1 (x=1*x+0). SAS has options to add vertical or horizontal reference lines (x=5 or y=10) but not for x=y. That it why you would need to either plot another line (x*x or y*y) or use the annotation facility to draw a line on top of the graph.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Doh! 🙂 Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi ... just to add onto the x*x suggestion already made ...
* some fake data;
data x;
do x = 1 to 10;
y = 6 + ceil(10*ranuni(999));
output;
end;
run;
goptions reset=all;
symbol1 v=dot c=blue;
symbol2 i=join c=blue ;
proc gplot data=x;
plot (y x)*x / overlay;
run;
quit;
also, using annotate is actually a bit harder in that the above method does not require you to have any knowledge as to how SAS/Graph will choose the ranges of the x and y axes
if you use annotate, then only safe way to add the line is to control the axis ranges with AXIS statements that specify ORDER and then use that axis range info to specify end points of a line drawn with annotate
* some fake data;
data x;
do x = 1 to 10;
y = 6 + ceil(10*ranuni(999));
output;
end;
run;
goptions reset=all;
symbol1 v=dot c=blue;
symbol2 i=join c=blue ;
proc gplot data=x;
plot (y x)*x / overlay;
run;
quit;
also, using annotate is actually a bit harder in that the above method does not require you to have any knowledge as to how SAS/Graph will choose the ranges of the x and y axes
if you use annotate, then only safe way to add the line is to control the axis ranges with AXIS statements that specify ORDER and then use that axis range info to specify end points of a line drawn with annotate