MATLAB函数barh()

此函数创建水平条形图, 其中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函数barh()

文章图片

    推荐阅读