hello all-
is there any procedure that can interactivaely rotate 3d plots. right now i am using proc g3d and using the rotate and tilt options but it would be nice to have an interactive graph that i can just rotate with my mouse.
any suggestions?
george
Hey George,
Just use GOPTIONS DEVICE=ACTIVEX with your PROC G3D program, and you will get interactive output. You will also need to wrap your program with ODS HTML to generate html output to contain the ACTIVEX control.
Hope this helps!
Dan
I think that the following might provide the info you are looking for:
Hey George,
Just use GOPTIONS DEVICE=ACTIVEX with your PROC G3D program, and you will get interactive output. You will also need to wrap your program with ODS HTML to generate html output to contain the ACTIVEX control.
Hope this helps!
Dan
Thanks guys!
Hi ... you can also try some animation. This plot has been around for a while and
I cut/pasted/modified some SAS code from Richard Devenezia's wonderful web site ...
http://www.devenezia.com/downloads/sas/samples/cowboy-hats.sas
data hat;
do x=-5 to 5 by .25;
do y=-5 to 5 by .25;
z=sin(sqrt(x*x+y*y));
output;
end;
end;
run;
%macro plots (n);
%local i;
%do i = 1 %to &n;
%let rotate = %sysevalf(90 * &i/&n);
%let tilt = %sysevalf(90 * &i/&n);
%put ITERATION &i;
%if &i eq 2 %then goptions gsfmode=append;;
%if &i eq &n %then goptions gepilog='3B'x;;
title "ROTATE & TILT: &rotate DEGREES" ls=2;
proc g3d data=hat;
plot y*x=z/ctop=white cbottom=yellow noaxis rotate=&rotate tilt=&tilt;
run;
quit;
%end;
title;
%mend;
goptions reset=all device=gifanim gsfname=animout xpixels=1024 ypixels=768
gsfmode=replace gunit=pct ftext='calibri/bo' ctext=yellow cback=grayaa
htitle=4 htext=3 border
iteration=1 /* specify one iteration for the animation */
delay=10; /* delay in 0.01 seconds) */
filename animout "z:\cowboy.gif";
filename tmp temp;
options nomprint nonotes;
ods listing file=tmp;
%plots(100);
ods listing;
options notes;
If you have a SAS/Insight license, you can also use that to create & rotate a 3d chart.
For example...
Run dms SAS on Windows.
Run 'insight' from the SAS command line.
Select/Open a data set - I'll use maps.africa for this quick example
Select/drag your mouse across the Density & X & Y variables in the table (just for the sake of an easy example)
Run the "Analyze -> Rotating Plot (Z Y X)" from the pulldown menu at the top edge of the dms sas session.
You now have a 3d scatter plot.
You can use the navigation buttons along the left to rotate the plot in 3d.
Move your mouse pointer to a corner of the graphics area, and it will turn to a hand.
Hold the mouse button down while it's a hand, and then you can use the hand to interactively spin the plot.
You can even give the plot a good push/spin, and let go of the mouse button, and the plot will continue to spin - I'm not sure how useful this is, but it's pretty cool to watch!
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.