At PharmaSUG 2014 in San Diego, I had the pleasure of attending "Swimmer Plot: Tell a Graphical Story of Your Time to Response Data Using PROC SGPLOT", by Stacey Phillips. In this paper, Stacey presented an interesting graph showing the effects of a study drug on patients' tumor size.
Stacey says in her paper that often "investigators prefer to dig deeper and look at an individual subject’s pattern of response. A swimmer plot is a graphical way of showing multiple pieces of a subject’s response 'story' in one glance." The final graph includes a bar showing the length of treatment duration for each patient, classified by the disease stage at baseline, one for each patient in the study. Graph also includes indicators for the start and end of each response episode, classified by complete or partial response, and an indicator showing whether the patient is a "Durable responder".
Stacey uses a combination of HBarParm, Scatter and annotations to create this graph. The annotation is used for adding the "Continued response" arrow, and for the display of the inner legend for decoding of the various symbols in the graph.
Along with many of the attendees of the presentation, I was impressed and intrigued by this visual. I was curious if its creation could be simplified using some of the new features released with SAS 9.3. In particular, I wanted to see if I could make this graph without any annotation.
The data used to create the graph is is eyeballed from Stacey's graph and shown above. Updated graph is shown below. Click on the graph for a higher resolution image.
- This graph uses the High Low plot to draw the bar representing the duration of the response for each subject.
- The bar has a arrow on the right side to indicate a continued response. This is explained in the 1st footnote.
- Each response episode is represented by start and end events joined by a line classified by the type of response - Complete or Partial. Connecting the start and end event and using a common classification color groups these together as one event, and is easier for the eye to consume. Continuing response does not have an end event on the right.
- All event lines and markers are included in the inner legend.
It is also possible to place the indicator for continued event into the key legend using a "TriangleRightFilled" marker in the graph. This marker is drawn outside the plot region, but is included in the legend. Some items in the legend are shown in grey, to indicate the meaning of the shape since the actual marker will have different colors in the graph based on other criteria.
The graph on the right uses SAS 9.4 with a few aesthetic features for bar skins and filled, outlined markers. Note the shorter line segments in the legend.
Note, the marker for the right arrow in intentionally made bigger to match the right arrows of the HighCap of the HighLow plot.
SAS 9.3 Code:
footnote J=l h=0.8 'Each bar represents one subject in the study.'; footnote2 J=l h=0.8 'A durable responder is a subject who has confirmed response for at least 183 days (6 months).'; proc sgplot data= swimmer dattrmap=attrmap nocycleattrs; highlow y=item low=low high=high / highcap=highcap type=bar group=stage fill nooutline lineattrs=(color=black) name='stage' nomissinggroup transparency=0.3; highlow y=item low=startline high=endline / group=status lineattrs=(thickness=2 pattern=solid) name='status' nomissinggroup attrid=status; scatter y=item x=start / markerattrs=(symbol=trianglefilled size=8 color=darkgray) name='s' legendlabel='Response start'; scatter y=item x=end / markerattrs=(symbol=circlefilled size=8 color=darkgray) name='e' legendlabel='Response end'; scatter y=ymin x=low / markerattrs=(symbol=trianglerightfilled size=14 color=darkgray) name='x' legendlabel='Continued response '; scatter y=item x=durable / markerattrs=(symbol=squarefilled size=6 color=black) name='d' legendlabel='Durable responder'; scatter y=item x=start / markerattrs=(symbol=trianglefilled size=8) group=status attrid=status; scatter y=item x=end / markerattrs=(symbol=circlefilled size=8) group=status attrid=status; xaxis label='Months' values=(0 to 20 by 1) valueshint; yaxis reverse display=(noticks novalues noline) label='Subjects Received Study Drug' min=1; keylegend 'stage' / title='Disease Stage'; keylegend 'status' 'd' 's' 'e' 'x' / noborder location=inside position=bottomright across=1; run;
The part that I believe makes this version easier to consume is the continuity of the response events. Joining the start and end events with a line segment, all having the same color as per the event classification allows the eye to see each event and its duration clearly.
The part I like best is the graph uses no annotation.
Full SAS 9.3 Code:Swimmer_93