I am trying to create what I believe to be a relatively simple set of boxplots. I want to be able to group the x-axis by certain variables. Then the legend should show the differences.
I am plotting the "number of errors" on the y-axis vs 2 variables on the x. First one being "Test_Time_bin" and second being "Substrate" The number of values for both Test_Time and Substrate will change for every dataset I am going to plot so I cannot hard code anything. For each value of "Test_Time_Bin" I want multiple boxplots (side by side) for each value of "Substrate".
I have searched around and haven't had any luck with finding example code. I did find a picture of the exact thing I want to do for reference. Figure 2 at this link:
With traditional SAS/Graph "proc gchart", you can do grouped bar charts, and turn on the 'errorbar' on each bar, and get something a little bit similar (not exactly what you're wanting though). For example:
To get something more like the graph in your link, you'd have to pre-calculate everything, and then put together a special data set to do a grouped bar, with a "floating" bar segment for the yellow part (by 'floating', I mean the lower of the 2 segments would be the same color as the background, making it 'invisible', such as ... http://robslink.com/SAS/democd6/col8.htm ). And then annotate the box plot onto each of the bars (you'd need to pre-calculate the y-value for each of the pieces of the boxplot to use to construct your box plot: mean, lower, upper, etc). It would be a bit "cumbersome"
Maybe/hopefully one of the new ODS Graphics procs provides an easier solution(?)
I don't like the idea of having to jump through too many hoops to get at what I want so I'm going to explore the SGPANEL solution, which is very close to what I want.
After I plugged in my data set, I would like 2 additional changes (if possible). #1 is kind of a show stopper and number 2 is just a nicety.
1. I need the panelby variable (test_time_bin) to display only the values on the graph. It is currently combining the variable name + the value. For example I need it to be "a. 0-100 hrs" instead of "Test_Time_Bin = a. 0-100 hrs", etc..... The data actually gets cut off unless I create a huuuuuuuuuuge graph, which I don't want to do.
2. I would like to get this entire group of panelby groups to the bottom of the graph instead of the top.
Boy I sure wish this forum would accept pictures so I could clearly explain what I'm looking for. Let me know if you need more info.
here's the code so far.
ods graphics / reset width=1200px height=700px MAXLEGENDAREA=50 IMAGEMAP=On;
ods html file='test.html' path="C:\" style=Festival;
title "Test Boxplots";