The drawback of this that you will loose median lineI 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,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.
this only effects the outline color of the box, I would like to change the fill color of the box & whisker plot.
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
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (3 / 13) |
Uptime: | 78:25:39 |
Calls: | 6,491 |
Calls today: | 2 |
Files: | 12,096 |
Messages: | 5,276,467 |