bar() function broken for large data sets when bar color is changed?
2 次查看(过去 30 天)
显示 更早的评论
Hi, I am using the bar() function to plot detailed histograms of 12-bit image data, e.g. using 4096 bins. But I am having some problems when I change the bar color. It seems that the bar plot gets corrupted when there are a large number of data points; but there is no problem if (a) the bar color is left as default and/or (b) fewer data points are used.
Here's an example that reproduces the problem (figure 2 is the corrupt one):
% Create a detailed histogram
x = 128*round(32*rand(1,100^2)); % <- Some random data with histogram gaps
[n,b] = hist(x,128*32); % 128*32=4096
figure;
bar(b,n); % This one looks ok, using default color
figure;
bar(b,n,'r'); % Should look the same as the first one (only red), but is an unreadable mess.
% Compare to plotting only a subset of the histogram:
subrange = 1:400;
figure;
bar(b(subrange),n(subrange));
figure;
bar(b(subrange),n(subrange),'r'); % Only 400 data points, looks fine!
Am I doing something wrong or is this a bug? I am using R2014a (8.3.0.532)
Thanks, BG
8 个评论
dpb
2014-6-2
Did you try resetting it to something other than 'OpenGL' on the corrupt ones to see if that had any bearing? Seems strange that it's different by default...
采纳的回答
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

