barh
Plot bar graph horizontally
Syntax
barh(y)
barh(x,y)
barh(...,宽度)
barh(...,style)
barh(...,'color
')
barh(...,'PropertyName',PropertyValue,...)
barh(ax,...)
b = barh(...)
描述
Abarh
图将矢量或矩阵中的值显示为水平条。
barh(y)
为每个元素绘制一个水平条y
。如果y
是a matrix,barh
groups the bars produced by the elements in each row. They-axis scale ranges from 1 up to冗长)
什么时候y
是矢量,1
tosize(y,1)
,这是行的数量,当y
是矩阵。值中的值y
可以是数字或持续时间值。
barh(x,y)
为每个元素画一个条y
在指定的位置x
, 在哪里x
是a vector defining locations along they设在。的location values can be nonmonotonic, but cannot contain duplicate values. Ify
是a matrix,barh
将每一行的元素分组为y
at corresponding locations inx
。值中的值x
can be numeric, datetime, duration, or categorical values.
barh(...,宽度)
设置相对条形宽度并控制组内条的分离。默认值宽度
是0.8
, so if you do not specifyx
,一组内的条具有轻微的分离。如果宽度
是1
, the bars within a group touch one another. The value of宽度
必须是标量。
barh(...,style)
指定条形的样式。指定风格
作为这些价值之一:
“分组”
显示mgroups ofn酒吧,哪里m是the number of rows andn是列中的数量y
。Each group contains one bar per column iny
。这是默认值。“堆积”
显示one bar for each row iny
。的bar length is the sum of the elements in the row. Each bar is multicolored, with colors corresponding to distinct elements and showing the relative contribution each row element makes to the total sum. Thebarh
function treats all vectors as column vectors. Ify
是长度的向量n, thenbarh
显示nbars.'histc'
以直方图格式显示图形,其中杆相互接触。'hist'
also displays the graph in histogram format, but centers each bar over the tick value, rather than making bars span the tick values as the历史c
option does.
不te
当您使用任何一个历史
或者历史c
选项,您也不能使用参数/值语法。这两个选项创建Patch
对象而不是酒吧
objects.
barh(...,'
使用单字母缩写指定的颜色显示所有条color
')'r'
,'g'
,'b'
,'c'
,'M'
,'y'
,'K'
, or'w'
。
barh(...,'PropertyName',PropertyValue,...)
将命名属性或属性设置为指定值。当您无法指定属性时历史
或者历史c
使用选项。看栏属性了解更多信息。
barh(ax,...)
plots into the axesax
而不是进入电流轴(gca
)。
b = barh(...)
返回一个向量酒吧
objects. Wheny
是a matrix,barh
creates one酒吧
object per column iny
。Each酒吧
object comprises a set of bars that have the same color. Useb
to change properties for all bars in a酒吧
目的。