A Spider Plot is another way of presenting the Change from Baseline for tumors for each subject in a study by week. The plot can be classified by response and stage. Another way of displaying Tumor Response data was discussed earlier in the article on Swimmer Plot.
This article is prompted by a question on the SAS communities page on how to create a Spider plot. The user provided an illustration of what the plot might look like. I followed the example and generated some data to create the graph shown on the right. Click on the graph for a higher resolution view.
The data is arranged in six columns. Four columns are needed to draw the progression of the disease for each subject over time: Subject, Week, Change, RGroup.
Two additional columns are used to display the status at the end of the curve for each subject: WeekS, TGroup. The first three observations are just to ensure the groups are assigned colors in the order we want. A Discrete Attributes Map can be used, but I ran into some minor difficulties, so I skipped that step. This exercise helped reveal a minor problems, but I was able to work around it.
In this case, WeekS=Week+2 in this case, to position the marker at the right of the curve. Only the last point in the curve has this nonmissing value.
The SAS 9.4M2 options for coloring the series and markers by another classifier (GroupLC and GroupMC) is used to color each curve for the Subject by the Response Group (RGroup). Note, the connectivity for each curve is determined by setting Group=Subject. Then, with in this, the color of each curve is set by setting GroupLC=RGroup. This allows multiple curves to be classified in the same category.
The SAS 9.40M1 SymbolChar statement is used to define a few symbols to represent the status of each Subject, such as "Treatment Ongoing" etc. These are inserted into the group symbols list using the DataSymbols option. Custom group data colors are set using the DataContrastColor option.
A Scatter plot is used to display these markers.
SAS 9.4M2 SGPLOT Code:
title "Tumor Response by Week";
ods graphics / reset width=5in height=3in imagename='Spider';
proc sgplot data=spider noborder tmplout='c:\spider.sas';
format tgroup $growth.;
symbolchar name=ongoing char='2192'x / scale=1;
symbolchar name=growtht char='2020'x / scale=1;
symbolchar name=growthnt char='2021'x / scale=1;
styleattrs datacontrastcolors=(green gold red)
datasymbols=(ongoing growtht growthnt );
refline 0 / lineattrs=(pattern=shortdash);
series x=week y=change / group=subject grouplc=rgroup groupmc=rgroup
lineattrs=(thickness=2 pattern=solid) name='a';
scatter x=weekS y=change / group=TGroup markerattrs=(size=16 color=black)
keylegend 'a' / title='Response' type=linecolor valueattrs=(size=7)
location=inside position=topright across=1 opaque;
keylegend 'b' / valueattrs=(size=7) noborder;
There are also examples of Spider plots with negative date values on the x-axis. These appear to track the disease state before and after start of treatment. The above code will likely work if the data itself includes values from before start of treatment and the baseline value is 1.0.
Full SAS 9.4M2 SGPLOT code: spider