How can I remove the bars without values in hist3?

8 views (last 30 days)
I'm using the hist3 function to plot a data distribution. I would like to remove all the bars that are zero. Picture 1 (yellow) is the way I want my graph to look but at the moment it looks like picture 2 (blue) where it displays all bars which are zero. Is their an option to change this?
Thanks a lot!
Goal.PNG
Fault.PNG

Accepted Answer

Adam Danz
Adam Danz on 14 Jun 2019
Edited: Adam Danz on 14 Jun 2019
Use histogram2() instead (req. 2015b or later).
% Instead of
hist3([x,y]);
%use
histogram2(x,y)
By default bars with 0 height are not drawn.
190613 200501-Bivariate histogram plot - MATLAB.jpg
  2 Comments
Adam Danz
Adam Danz on 14 Jun 2019
Edited: Adam Danz on 14 Jun 2019
Glad I could help! Nice brain profile pic!

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!