0
votes

I have drawn a histogram of a variable I using the function hist available in Matlab R2012b. hist(I(:),100); I have got the following result, it is a histogram : enter image description here

The problem is as follow: I don't care about the values on Zero following X-axis. I would like to draw a histogram without putting focus on the huge value of zeros.

I found this solution :

[counts,centers] = hist(I(:));
[~,i] = max(counts);
counts(i)= 0;
bar(centers,counts);

But it seems not good one !

Is there a way to specify bins interval without zero !? is there a way, using code, to zoom in so that I can recognize clearly the other bars ?

The documentation of the function hist is available here.

Any suggestion is a welcome.

1

1 Answers

1
votes

If you don't care about zeros, don't pass them to hist:

hist(I(I~=0),100)