Clear Filters
Clear Filters

colors of barh

13 views (last 30 days)
am
am on 10 May 2012
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.

Answers (2)

Thomas
Thomas on 10 May 2012
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 on 10 May 2012

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!