colors of barh

13 次查看(过去 30 天)
am
am 2012-5-10
hello, i'm using the
barh(v,'stack')
function, where v is a matrix. the problem is that i cant figure how to make a different color for each value, for example i expect a [1,2,3;2,2,2] matrix to have 6 colors and [3,0,0;1,1,1] to have 4 colors. i tried using colormap but i didn't get 6/4 different colors. any suggestions? thanks.

回答(2 个)

Thomas
Thomas 2012-5-10
Unfortunately that is not how barh works. You can find more documentation on barh usign
doc barh
%
v=[1,2,3;2,2,2];
barh(v,'stack')
will give you two stacked bar graphs of 3 colors since there are 3 element in both of your arrays.. All barh with 'stack' does is plot a bar graph make it horizontal and stacks values on each other instead of appearing as separate bars.
I donot think colormap will help you here either..

Image Analyst
Image Analyst 2012-5-10

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by