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:
omit zeros in boxplot

Subject: omit zeros in boxplot

From: galib

Date: 12 Jan, 2011 09:05:04

Message: 1 of 3

Hello,

I have got problem with boxplot. I have a 2D matrix of different row size. So, the rows with smaller size are padded with zeros. When I use boxplot(myMatrix') to get the boxes for each row, MATLab is taking the zeros as data. So, the boxes become bigger in size which I do not want. Do you have a solution for this? Please, let me know. I am giving an example below.

myMatrix = [ 29 30 33 33 0 0 0 0
                   40 28 35 32 35 32 32 35
                   30 40 36 35 35 35 0 0
                   28 24 24 25 24 24 25 0
                   33 35 29 31 29 29 0 0 ]

boxplot(myMatrix);
this gives the box sizes with the zeros. But I want to omit the last zeros. Please, let me know if you have a solution.

Thanks.

Galib

Subject: omit zeros in boxplot

From: B. Schmidt

Date: 18 Jan, 2011 20:25:05

Message: 2 of 3

"galib " <galib.cse@gmail.com> wrote in message <igjqs0$14b$1@fred.mathworks.com>...
> Hello,
>
> I have got problem with boxplot. I have a 2D matrix of different row size. So, the rows with smaller size are padded with zeros. When I use boxplot(myMatrix') to get the boxes for each row, MATLab is taking the zeros as data. So, the boxes become bigger in size which I do not want. Do you have a solution for this? Please, let me know. I am giving an example below.
>
> myMatrix = [ 29 30 33 33 0 0 0 0
> 40 28 35 32 35 32 32 35
> 30 40 36 35 35 35 0 0
> 28 24 24 25 24 24 25 0
> 33 35 29 31 29 29 0 0 ]
>
> boxplot(myMatrix);
> this gives the box sizes with the zeros. But I want to omit the last zeros. Please, let me know if you have a solution.
>
> Thanks.

Have you tried replacing the zeros in your matrix with NaN?
>
> Galib

Subject: omit zeros in boxplot

From: galib

Date: 18 Jan, 2011 21:48:05

Message: 3 of 3

"B. Schmidt" wrote in message <ih4sv1$fob$1@fred.mathworks.com>...
> "galib " <galib.cse@gmail.com> wrote in message <igjqs0$14b$1@fred.mathworks.com>...
> > Hello,
> >
> > I have got problem with boxplot. I have a 2D matrix of different row size. So, the rows with smaller size are padded with zeros. When I use boxplot(myMatrix') to get the boxes for each row, MATLab is taking the zeros as data. So, the boxes become bigger in size which I do not want. Do you have a solution for this? Please, let me know. I am giving an example below.
> >
> > myMatrix = [ 29 30 33 33 0 0 0 0
> > 40 28 35 32 35 32 32 35
> > 30 40 36 35 35 35 0 0
> > 28 24 24 25 24 24 25 0
> > 33 35 29 31 29 29 0 0 ]
> >
> > boxplot(myMatrix);
> > this gives the box sizes with the zeros. But I want to omit the last zeros. Please, let me know if you have a solution.
> >
> > Thanks.
>
> Have you tried replacing the zeros in your matrix with NaN?
> >
> > Galib

Oh, I solved it using the NaNs... Thanks anyway :)

Tags for 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