此函数创建水平条形图, 其中x中的值用于标记每个条, y中的值用于确定条的水平长度。
句法
barh(y) // It creates a horizontal bar graph with one bar for each element in y. If y is an m-by-n matrix, then barh creates m groups of n bars.barh(x, y)// It draws the bars along the vertical axis at the locations specified by x.
例子
World population by continentscont=char ('Asia', 'Europe', 'Africa', ...'N.America', 'S.America');
pop=[333.2;
696;
694;
437;
307];
barh(pop)for i=1:5, gtext(cont(i, :));
endxlabel('Population in millions');
Title (World population (1992)', 'fontsize', 18)
【MATLAB函数barh()】输出
文章图片
推荐阅读
- MATLAB函数hist()
- MATLAB函数errorbar()
- MATLAB函数plotyy()
- MATLAB 函数fill()
- MATLAB函数Bar()
- MATLAB绘图操作详解
- MATLAB 2D极坐标绘图Plots()
- MATLAB 函数Semilogy()
- MATLAB 函数loglog()