log -log histogram, unequal bin sizes and bar edges
1 view (last 30 days)
Show older comments
Hi, I want to create a loglog histogram with unequal bin size (see the histogram in the lower right of the picture below). The problem is that the width of the bars change and don't connect with each other, ie the edges of the bars do not show the bin size. Is there a way to do this? The histogram (lower-right) was created with the following code
edges=[1 2 3 4 5 10 20 40 60 80 1e2 2e2 4e2 6e2 8e2 1e3 2e3 4e3 6e3 8e3 1e4 2e4 4e4 5e5];
[binvals1]=histc(RTtrue_info(:,2),edges);
h1=barh(edges,(binvals1),'parent',axes3,'facecolor',[0.6 0.6 0.6],'edgecolor',[0.6 0.6 0.6]);
set(h1,'barwidth',0.4);
hold off
set(axes3,...
'ylim',[y_padding1 1e5],...
'xlim',[0 1e5],...
'xscale','log',...
'yscale','log',...
'yticklabel',{},...
'xtick',[1e0 1e1 1e2 1e3 1e4]);
![](https://www.mathworks.com/matlabcentral/images/broken_image.png)
I imagine that the histogram should look something like this, but with log scale.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151145/image.png)
I appreciate any help I can get!
0 Comments
Answers (1)
Image Analyst
on 19 Feb 2013
I don't see that hist() takes an "edges" input argument. I think you want histc() instead.
2 Comments
Image Analyst
on 19 Feb 2013
You can supply data if you want people to try something: http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!