Data visualization with SAS programming

rotating 3d plots

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 75
Accepted Solution

rotating 3d plots

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


Accepted Solutions
Solution
‎07-26-2011 04:11 PM
SAS Super FREQ
Posts: 888

rotating 3d plots

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

View solution in original post


All Replies
Esteemed Advisor
Posts: 7,285

rotating 3d plots

I think that the following might provide the info you are looking for:

http://www.robslink.com/SAS/democd8/uscont_info.htm

Solution
‎07-26-2011 04:11 PM
SAS Super FREQ
Posts: 888

rotating 3d plots

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

Frequent Contributor
Posts: 75

rotating 3d plots

Thanks guys!

Valued Guide
Posts: 763

Re: rotating 3d plots

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;

SAS Employee
Posts: 967

Re: rotating 3d plots

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! Smiley Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 1474 views
  • 4 likes
  • 5 in conversation