Histogram problem
3 次查看(过去 30 天)
显示 更早的评论
I plotted a histogram. I now trying to chang the way the x- axis is read.
The Data is huge so it currently reads 0, 200, 400, 800, 1000 Meanwhile i would like it to show the other bin sizes. my bin width is 5, therefore
I would like it to show 0, 5, 10, 15, 20..... 1000
I tried this hist(data(1:29196,1),[0:5:1000]);figure(gcf);
Thanks for any help received
0 个评论
采纳的回答
Walter Roberson
2011-8-2
set(gca, 'XTick', 0:5:1000)
However, this seems likely to want to place the labels so closely together that they will become unreadable.
If your data is sufficiently large, there is a possibility that representing it all would require more space than you have available in your figure. There really isn't any effective way of dealing with that except for allowing more space for the axes, or providing a partially-visible uipanel with scroll bars (FEX contributions available) that shows the image at a higher resolution.
0 个评论
更多回答(1 个)
the cyclist
2011-8-2
It would be helpful if you posted the code that generates the histogram, but I am guessing what you are asking for is this:
set(gca,'XTick',0:5:1000)
However, I don't think so many ticks are going to be legible. You might need to compromise.
7 个评论
Kelly Kearney
2011-8-3
Actually, I think Walter is misusing the outputs of histc:
edge = 0:5:1000;
[b,bin] = histc(data(1:29196,1), edge);
bar(edge,b,'histc');
is what I think he intended.
Walter Roberson
2011-8-3
Yes, that would make sense, Kelly. This could be further reduced to
edge = 0:5:1000;
bar(edge, histc(data(1:29196,1),edge), 'histc')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!