A few months ago, a user inquired about a chart that showed tumor response and treatment duration for each subject on 2 different planes of a 3D view. The data was really 2D, with one independent variable (the subject id) and two or more response values. I had provided an alternate (and in my view, better) visual to view this data in this article.
Recently there has been more interest shown by users in creating a 3D visual of the same data using SAS. Questions have come into Technical Support for creating a graph like the one shown below. So I thought it would be useful to see how this could be done using ODS Graphics. ODS Graphics (SGPLOT or GTL) does not have any way to create such a graph using layout containers or plot statements directly. It would be useful to note this visual is a non-standard usage of 3D. Normally, 2 dimensions on the "floor" are used for classification or a numeric grid, with the third (vertical) dimension as the response.
In this case, we have only one independent variable on the left horizontal axis. The left vertical plane is used to display the tumor response, and the horizontal plane to display the duration of treatment. To create this graph I used a technique similar to what I had described earlier in the A 3D Scatter Plot article from March 2015 to create this custom graph. I modified the 3D scatter macro to render the two responses as mentioned above. The macro handles all the 3D transformations and projections, and then uses SGPLOT to render the visual. Here is the macro output:
The macro call looks like this. The ATTRMAP option is currently not used.
%WaterFall_3D_Macro (Data=waterfall3D, WallData=wall_Axes, Pid=pid,
X=x, Y=y, Z=z, Lblx=Subject, Lbly=Duration, Lblz=Response,
Group=grp, Attrmap=attrmap, Tilt=65, Rotate=-55,
Title=Tumor Response and Duration);
Data is provided in a data set "Waterfall3D", where the "Response" and "Duration" are provided as values for 2 groups by subject id. The data could be easily restructured as two columns by the subject id. While I labeled the axes, I stopped here before continuing to add more details to get a feel whether this is really something the SAS user community is demanding. I can add more details (additional overlays, axis details, etc) based on your response. If you really want such a graph, please include the details you would like to see in the graph.
At the risk of being repetitive, I would still suggest that this data can be better visualized using a standard 2D graph as shown below. This can be easily done using SGPLOT statements. Additional data layers can be easily added. I will publish a GTL version with 2 rows where the yaxis information is on the left for both.
proc sgplot data=tumor2;
vbarparm category=i response=duration / fillattrs=graphdata1 dataskin=pressed y2axis;
vbarparm category=i response=response / fillattrs=graphdata2 dataskin=pressed;
yaxis offsetmax=0.5 labelpos=datacenter grid display=(noline noticks);
y2axis offsetmin=0.55 labelpos=datacenter grid display=(noline noticks);
xaxis display=none colorbands=odd colorbandattrs=(transparency=0.3);
I have not yet included the 3D Macro code in this article as it is incomplete. I will do that once all the details are in. I really hope this will stimulate a conversation among our clinical users on the need and desirability of such a graph to visualize this data. I look forward to your feedback.