Hi,
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.
Please help.
|
|
0
|
|
|
|
Reply
|
Ian
|
1/5/2011 7:10:23 PM |
|
> 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
|
|
0
|
|
|
|
Reply
|
Tom
|
1/6/2011 3:49:28 PM
|
|
"Tom Lane" <tlane@mathworks.nospam.com> wrote in message <ig4oa8$d8a$1@fred.mathworks.com>...
> > 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
Thanks for the advice tom! That code above works perfectly :)
|
|
0
|
|
|
|
Reply
|
Ian
|
1/15/2011 9:20:18 PM
|
|
On 15 jan, 22:20, "Ian " <isha...@uic.edu> wrote:
> "Tom Lane" <tl...@mathworks.nospam.com> wrote in message <ig4oa8$d8...@fr=
ed.mathworks.com>...
> > > 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 chang=
e the
> > > fill color of the box & whisker plot.
>
> > Ian, as you probably suspect there's no built-in way to do this. The bo=
x 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 transpar=
ency
> > so the median line will show through.
>
> > =A0load carsmall
> > =A0boxplot(MPG,Origin)
> > =A0h =3D findobj(gca,'Tag','Box');
> > =A0for j=3D1:length(h)
> > =A0 =A0 patch(get(h(j),'XData'),get(h(j),'YData'),'y','FaceAlpha',.5);
> > =A0end
>
> > -- Tom
>
> Thanks for the advice tom! =A0That code above works perfectly :)
Excellent
Thanks
|
|
0
|
|
|
|
Reply
|
hermann
|
1/27/2011 2:18:48 PM
|
|
|
3 Replies
1093 Views
(page loaded in 0.002 seconds)
Similiar Articles: how to fill boxplot with color - comp.soft-sys.matlabHi, 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... Add baseline to Boxplot - comp.soft-sys.matlabhow to fill boxplot with color - comp.soft-sys.matlab Hi, I am looking to fill my 'notched' boxplot with different colors, one for ... 3 set title "title" 5,0 set style ... boxplot - comp.lang.idl-pvwavehow to fill boxplot with color - comp.soft-sys.matlab Hi, I am looking to fill my 'notched' boxplot with different colors, one for the control group and one for the ... boxplot - comp.soft-sys.sashow to fill boxplot with color - comp.soft-sys.matlab Hi, I am looking to fill my 'notched' boxplot with different colors, one for the control group and one for the ... How to change the fontsize of labels of boxplot - comp.soft-sys ...how to fill boxplot with color - comp.soft-sys.matlab goptions Axis font size and type - comp.soft-sys.sas How to change the fontsize of labels of boxplot - comp.soft-sys ... A question about boxplot - comp.soft-sys.matlabhow to fill boxplot with color - comp.soft-sys.matlab Hi, I am looking to fill my 'notched' boxplot with different colors, one for ... soft-sys.matlab Add baseline to ... how to bucket fill? - comp.graphics.apps.gimphow to fill boxplot with color - comp.soft-sys.matlab I want to create a functionality to be able to highlight - change background color ... highlight (change background ... Boxplot Y-Axis Change - comp.soft-sys.matlabI have a y-axis label on a boxplot of around -4 x 10^-4 to 1 x 10^-4 (that is ... axis, is there one ... comp.soft-sys.matlab... sys.matlab how to fill boxplot with color ... one line plot with different colors - comp.soft-sys.matlab ...how to fill boxplot with color - comp.soft-sys.matlab... boxplot with different colors, one ... patches a color, and some transparency so the median line will ... how to set fontsize in matlab linux - comp.soft-sys.matlab ...... change the fontsize of labels of boxplot - comp.soft-sys ..... load carsmall boxplot(MPG,Origin) h = findobj(gca,'Type','text') set ... how to fill boxplot with color ... how to fill boxplot with color - comp.soft-sys.matlab | Computer GroupHi, 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... Quick-R: BoxplotsBoxplots . Boxplots can be created for individual variables or for variables by group. ... In the example above, if I had listed 6 colors, each box would have its own color. 7/20/2012 4:06:59 PM
|