Data visualization with SAS programming

Annotating box plots

Reply
Learner
Posts: 1

Annotating box plots

Hello.
I am using Proc Boxplot to make a grouped box and whisker plot. I am using annotate to draw brackets between boxes indicating statistically significant pair-wise differences.

How do I get three different color fills inside each of the three locations (Neck, Chest, Groin) and how do I then create a legend outside of the plot area that will include the color definition as well as the p-value labels that I currently have showing inside the plot area?

By the way, I would love to do this using Proc SGPanel. Does anyone know if SGPanel can be "tricked" into somehow adding brackets to a grouped boxplot?

Thanks,
Norma Ketchum

[pre]
goptions reset=goptions fill
device=PNG target=PNG Xmax=8 in Ymax=5 in
Ftext='arial' Ftitle='arial' gunit=pct
XPIXELS=4000 YPIXELS=4000 Htext=3.5 Htitle=3 ;

%annomac
data anno1;
length function style color $ 8 text $23;
retain hsys '3' xsys '3' ysys '3';
size=3; color='black'; function='label';
when='A';

%line(14.0, 75.0, 66.0, 75.0, red, 1,.1);
%line(14.0, 75.0, 14.0, 60.0, red, 1,.1);
%line(66.0, 75.0, 66.0, 74.0, red, 1,.1);
%LABEL (92.0, 84.0, "p<0.01", red, 0, 0, 3.00, arial, E);

%line(24.0, 73.0, 64.0, 73.0, blue, 1,.1);
%line(24.0, 73.0, 24.0, 65.0, blue, 1,.1);
%line(64.0, 73.0, 64.0, 72.0, blue, 1,.1);
%LABEL (92.0, 80.0, "p<0.05", blue, 0, 0, 3.0, arial, E);
run;

proc boxplot data=dose_final;
plot dose*group_loc \ boxwidth=8 cboxes=black cboxfill=lig CONTINUOUS
BOXSTYLE=schematic annotate=anno1
haxis=axis1 vaxis=axis2;
run;
quit;

[/pre]
SAS Employee
Posts: 967

Re: Annotating box plots

If you can't find another way, perhaps this example will be a good starting-place for creating a totally custom boxplot, using annotate to draw it ...

http://robslink.com/SAS/democd47/anno_boxplot_info.htm
http://robslink.com/SAS/democd47/anno_boxplot.htm
http://robslink.com/SAS/democd47/anno_boxplot.sas Message was edited by: Robert Allison @ SAS
SAS Super FREQ
Posts: 8,721
Ask a Question
Discussion stats
  • 2 replies
  • 143 views
  • 0 likes
  • 3 in conversation