【发布时间】:2013-08-29 15:34:13
【问题描述】:
我注意到有时,当我使用函数 bar() 或 hist() 绘制条形图时,绘制的条形图没有边框。它们看起来不太好看,我更喜欢它们之间的边界或一点空间。 该图显示了我现在得到的结果,绘制了三个不同的数据集。第三张图被放大以显示条之间的空间不足。
我知道这与 bar 函数中的 'histc' 参数有关。如果没有 histc 参数,条形之间会有一些空间,但是条形将以边缘值为中心,而我希望边缘值是每个条形的边缘。
这是我使用的代码(相关部分):
[...]
if edges==0
%these following lines are used to take the min and max of the three dataset
maxx=max(cellfun(@max, reshape(data,1,size(data,1)*size(data,2))));
minn=min(cellfun(@min, reshape(data,1,size(data,1)*size(data,2))));
edges=minn:binW:maxx+binW;
end
[...]
y{k}=histc(data{r,c}, edges);
bar(edges,y{k} , 'histc');
[...]
【问题讨论】:
标签: matlab graph plot histogram