📜  MATLAB 2D barh()

📅  最后修改于: 2021-01-07 02:37:52             🧑  作者: Mango

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 continents
cont=char ('Asia','Europe','Africa',...'N.America','S.America');
pop=[333.2;696;694;437;307];
barh(pop)
for i=1:5,
    gtext(cont(i,:));
end
xlabel('Population in millions');
Title (World population (1992)','fontsize', 18)

输出: