Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab Bar plot including Mean and Variance

Subject: Matlab Bar plot including Mean and Variance

From: saudrey@ee.ethz.ch

Date: 31 Jan, 2007 02:38:21

Message: 1 of 3

I am trying to draw a boxplot where the height accords to the mean of
a vector and a horizontal line according to the mean + variance and
the mean - variance (see picture (should be overlaying a box plot)).
      --- -> mean + variance
       =A6
       =A6 -> hear should be the top of the boxplot according to
the mean
       =A6
      --- -> mean - variance


could anyone tell me how to draw this. errorbar is a good solution,
but it doesn't produce a box, just a line for the mean.


thanks!

Deed

Subject: Matlab Bar plot including Mean and Variance

From: Jos

Date: 31 Jan, 2007 05:58:32

Message: 2 of 3

saudrey wrote:
>
>
> I am trying to draw a boxplot where the height accords to the mean
> of
> a vector and a horizontal line according to the mean + variance and
> the mean - variance (see picture (should be overlaying a box
> plot)).
> --- -> mean + variance
> ¦
> ¦ -> hear should be the top of the boxplot according to
> the mean
> ¦
> --- -> mean - variance
>
>
> could anyone tell me how to draw this. errorbar is a good solution,
> but it doesn't produce a box, just a line for the mean.
>
>
> thanks!
>
> Deed
>
>

use both bar and errorbar.

x=1:10 ;
y = 10*rand(size(x)) ;
L = rand(size(x)) ;
U = rand(size(x)) ;
bar(x,y)
hold on ;
h = errorbar(x,y,L,U) ;
delete(h(2)) ; % remove connecting line
hold off ;

hth
Jos

Subject: Matlab Bar plot including Mean and Variance

From: saudrey@ee.ethz.ch

Date: 1 Feb, 2007 00:48:43

Message: 3 of 3

On 31 Jan., 11:58, Jos <x...@y.z> wrote:
> saudrey wrote:
>
> > I am trying to draw a boxplot where the height accords to the mean
> > of
> > a vector and a horizontal line according to the mean + variance and
> > the mean - variance (see picture (should be overlaying a box
> > plot)).
> > --- -> mean + variance
> > =A6
> > =A6 -> hear should be the top of the boxplot according to
> > the mean
> > =A6
> > --- -> mean - variance
>
> > could anyone tell me how to draw this. errorbar is a good solution,
> > but it doesn't produce a box, just a line for the mean.
>
> > thanks!
>
> > Deed
>
> use both bar and errorbar.
>
> x=3D1:10 ;
> y =3D 10*rand(size(x)) ;
> L =3D rand(size(x)) ;
> U =3D rand(size(x)) ;
> bar(x,y)
> hold on ;
> h =3D errorbar(x,y,L,U) ;
> delete(h(2)) ; % remove connecting line
> hold off ;
>
> hth
> Jos- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Thank you very much. Worked great, except for matlab saying

??? Index exceeds matrix dimensions.

Error in =3D=3D> displayLearning at 65
    delete(h(2)) ; % remove connecting line


but I replaced

h =3D errorbar(x,y,L,U) ;
delete(h(2)) ;

with

 h =3D errorbar(x,y,L,U,'+') ;

which also made the connecting lines dissapear.

thank you very much again

Deed

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us