Matlab 将颜色更改为条形图

Matlab 将颜色更改为条形图,matlab,plot,bar-chart,Matlab,Plot,Bar Chart,我有矩阵A,我做了一个条形图 A = rand(15,9); h = bar(A); 现在,我想根据下面定义的colormap colorset为A的每一行的每组条形图上色 colorset = [0 0 1;... 1 0 0;... 0 1 0;... 0 0 0.172413793103448;... 1 0.103448275862069 0.724137931034483;... 1 0.827586206896552 0;... 0

我有矩阵A,我做了一个条形图

A = rand(15,9);
h = bar(A);
现在,我想根据下面定义的colormap colorset为A的每一行的每组条形图上色

colorset = [0   0   1;...
1   0   0;...
0   1   0;...
0   0   0.172413793103448;...
1   0.103448275862069   0.724137931034483;...
1   0.827586206896552   0;...
0   0.344827586206897   0;...
0.517241379310345   0.517241379310345   1;...
0.620689655172414   0.310344827586207   0.275862068965517]
我试着做一些类似的事情

set(get(h,'children'),'cdata', A );
colormap(colorset); 

但是运气不好

我认为这应该有帮助:

   for hi = 1:numel(h)
        set(h(hi), 'FaceColor', colorset(hi,:))
   end
在原色之前:

新颜色之后: