On Thursday, January 6, 2011 at 9:49:28 AM UTC-6, Tom Lane wrote:
I am looking to fill my 'notched' boxplot with different colors, one for the control group and one for the treated group.
I have found several ways to change 'colors' and 'groupcolor' however,
this only effects the outline color of the box, I would like to change the fill color of the box & whisker plot.
Ian, as you probably suspect there's no built-in way to do this. The box is formed as a series of lines, and it contains no object with a color to fill in.
Here's how I would do it. There's a relatively simple way to get the coordinates of the boxes. You can loop over them and make patches with the same coordinates. You can give those patches a color, and some transparency so the median line will show through.
load carsmall
boxplot(MPG,Origin)
h = findobj(gca,'Tag','Box');
for j=1:length(h) patch(get(h(j),'XData'),get(h(j),'YData'),'y','FaceAlpha',.5);
end
-- Tom
The drawback of this that you will loose median line
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)