Make values on y-axis in histogram to shrink.
2 次查看(过去 30 天)
显示 更早的评论
I have a Histogram of Binary Image. On y-axis I have values up to 2000. How can make it small so that the graph appears big. For example how can show only 1000 values on y-axis instead of 2000..
Thanks
0 个评论
回答(2 个)
Image Analyst
2012-4-22
A binary image will have only two bins, one at 0 and one at 1, since there are only two values (false and true, or 0 and 1) in the image. One bin will have some number of counts, like 1500, and the other bin will contain a value equal to the number of pixels in the image minus the count in the other bin.
If you want to clip the y axis to some value, you can use ylim:
ylim([0 1000]);
If you want to compress the y scale, then you can plot the log of the y values (the count values) instead of using it linearly:
pixelCounts = imhist(binaryImage, 2);
bar(log(pixelCounts));
but be sure to adjust the y axis labels to be the original y values instead of the logged y values.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!