帮助中心帮助中心
减少直方图 bin 数量
N = fewerbins(h)
N = fewerbins(h,direction)
N = fewerbins(h) 将直方图 h 中的 bin 数量减少 10%(向下四舍五入为最近的整数),并返回新的 bin 数量。
N
h
对于二元直方图,这会减少 x 和 y 这两个方向的 bin 计数。
示例
N = fewerbins(h,direction)(其中 h 必须是 histogram2 对象)仅会减少 direction 指定的维度中的 bin 数量。direction 选项可以是 'x'、'y' 或 'both'。默认值为 'both'。
direction
histogram2
'x'
'y'
'both'
全部折叠
绘制由 1,000 个随机数构成的直方图并返回直方图对象的句柄。
x = randn(1000,1); h = histogram(x)
h = Histogram with properties: Data: [1000x1 double] Values: [3 1 2 15 17 27 53 79 85 101 127 110 124 95 67 32 27 16 6 6 4 1 2] NumBins: 23 BinEdges: [-3.3000 -3.0000 -2.7000 -2.4000 -2.1000 -1.8000 -1.5000 -1.2000 -0.9000 -0.6000 -0.3000 0 0.3000 0.6000 0.9000 1.2000 1.5000 1.8000 2.1000 2.4000 2.7000 3 3.3000 3.6000] BinWidth: 0.3000 BinLimits: [-3.3000 3.6000] Normalization: 'count' FaceColor: 'auto' EdgeColor: [0 0 0] Use GET to show all properties
使用 fewerbins 减少直方图中的 bin 数量。
fewerbins
fewerbins(h); fewerbins(h)
ans = 18
histogram
输入直方图,指定为 histogram 或 histogram2 对象。
h 不能是分类直方图。
减少 bin 数量的方向,指定为 'x'、'y' 或 'both'。指定 'x' 或 'y' 仅会减少该方向的 bin 数量,而另一方向中的 bin 数量保持不变。
bin 数量,以标量或向量形式返回。N 是增加后的新的直方图的 bin 数量。对于二元直方图,N 是二元素向量 [nx ny]。
[nx ny]
在 R2014b 中推出
histogram | histcounts | histogram2 | histcounts2 | morebins
histcounts
histcounts2
morebins
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office